在日常维护中有的表数据量很大,进行大量delete的时候很慢,而且产生大量的UNDO。所以需要使用存储过程来进行分配提交;
declare
row_num number := 0;
begin
for bpms_del in(select done_task_id from BPMS_RU_DONE_TASK_MRTN where CUR_NODE_ID='000004') loop
delete from BPMS_RU_DONE_TASK_MRTN where done_task_id=bpms_del.done_task_id;
row_num := row_num +1;
---2000条提交一次,可根据需要修改
if mod(row_num,2000) = 0 then
commit;
end if;
end loop;
commit;
end;
/
declare
row_num number := 0;
begin
for bpms_del in(select done_task_id from BPMS_RU_DONE_TASK_MRTN where CUR_NODE_ID='000004') loop
delete from BPMS_RU_DONE_TASK_MRTN where done_task_id=bpms_del.done_task_id;
row_num := row_num +1;
---2000条提交一次,可根据需要修改
if mod(row_num,2000) = 0 then
commit;
end if;
end loop;
commit;
end;
/
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28869493/viewspace-1983559/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28869493/viewspace-1983559/