ITPub博客

首页 > 数据库 > Oracle > 过程3

过程3

原创 Oracle 作者:simkyo 时间:2013-11-28 09:24:47 0 删除 编辑
-- 游标逐个处理表,把不同的数据加入相应的临时表中
      open c_array_time;
      fetch c_array_time into v_a,v_b,v_c;
        while c_array_time%found loop
          -- 只有活动结束日期和排期日期都比系统时间小时,才算是完结
          if v_b < trunc(sysdate+5,'dd')  and v_c < to_char(sysdate+5,'yyyy-mm-dd') then
            -- 更新活动状态为完结
             update t_run_activity_plan_info t set t.exec_status = '7' where t.activity_code = v_a;
             commit;
          end if;
          fetch c_array_time into v_a,v_b,v_c;
        end loop;
      close c_array_time;

    -- 程序结束 记录日志
    v_task_pos := '程序结束';
    sp_ws_exec_log(v_task_name,v_table_name,v_task_pos,v_sqlerr,v_sqlmsg,v_curr_time,0);
    commit;

exception
  when input_error then
    sp_ws_exec_log(v_task_name,v_table_name,v_task_pos,v_sqlerr,v_sqlmsg,v_curr_time,1);
  when others then
    v_sqlerr := sqlcode;
    v_sqlmsg := substr(sqlerrm, 1, 200);
    rollback;
    sp_ws_exec_log(v_task_name,v_table_name,v_task_pos,v_sqlerr,v_sqlmsg,v_curr_time,1);
end;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12961536/viewspace-1061347/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 过程2
下一篇: 2
请登录后发表评论 登录
全部评论

注册时间:2013-06-20

  • 博文量
    193
  • 访问量
    165517