declare
cursor mycursor is SELECT ROWID FROM TEST WHERE XXX=XXXX order by rowid; <--------按ROWID排序的Cursor,删除条件是XXX=XXXX,根据实际情
况来定。
type rowid_table_type is table of rowid index by pls_integer;
v_rowid rowid_table_type;
BEGIN
open mycursor;
loop
fetch mycursor bulk collect into v_rowid limit 5000; <--------每次处理5000行,也就是每5000行一提交
exit when v_rowid.count=0;
forall i in v_rowid.first..v_rowid.last
delete from test where rowid=v_rowid(i);
commit;
end loop;
close mycursor;
END;
/
cursor mycursor is SELECT ROWID FROM TEST WHERE XXX=XXXX order by rowid; <--------按ROWID排序的Cursor,删除条件是XXX=XXXX,根据实际情
况来定。
type rowid_table_type is table of rowid index by pls_integer;
v_rowid rowid_table_type;
BEGIN
open mycursor;
loop
fetch mycursor bulk collect into v_rowid limit 5000; <--------每次处理5000行,也就是每5000行一提交
exit when v_rowid.count=0;
forall i in v_rowid.first..v_rowid.last
delete from test where rowid=v_rowid(i);
commit;
end loop;
close mycursor;
END;
/