我们可以使用Execute immediate进行批量删除吗(对于游标)
forall i in rowid.FIRST .. rowid.LAST
Execute Immediate 'DELETE table_name '||PARTIION_NAME||'where rowid =rowid(m)';
有没有其他方法可以完成这项工作......? 谢谢iN Advance
答案 0 :(得分:0)
我真的不明白你要对||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;
但我必须问 - 为什么?