我们可以使用 Execute immediate 进行批量删除,例如(对于游标)
forall i in rowid.FIRST .. rowid.LAST
Execute Immediate 'DELETE table_name '||PARTIION_NAME||'where rowid =rowid(m)';
有没有其他方法可以完成这项工作......?提前致谢
我真的不明白你想用 做什么||PARTIION_NAME||
,但你可以做这样的事情:
DECLARE
type rowid_tab is table of rowid;
rowids rowid_tab;
cursor c is select rowid from table_name where <some condition>;
BEGIN
open c;
fetch c bulk collect into rowids;
close c;
-- here is where the "real thing" starts
forall i in rowids.first .. rowids.last
execute immediate 'delete table_name where rowid = :1' using rowids(i);
commit;
END;
但我必须问 - 为什么?