-- 游标逐个处理表,把不同的数据加入相应的临时表中
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/
,如需转载,请注明出处,否则将追究法律责任。