如果表很大--千万级别的数据,又不能做truncate 操作,只能 delete 表中某部分数据时可以用以下来执行,这种方式只对大表操作时比较有效率,数据量小时不考虑
--示例如下
declare
cursor mycursor is SELECT ROWID FROM tpr_zjjx1 WHERE jxrq=to_date('2013-06-30','yyyy-mm-dd') order by rowid;
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;
exit when v_rowid.count=0;
forall i in v_rowid.first..v_rowid.last
delete from tpr_zjjx1 where rowid=v_rowid(i);
commit;
end loop;
close mycursor;
END;