3,491
社区成员
发帖
与我相关
我的任务
分享
declare
maxrows number default 1000;
tb_row_id type%tabacca.row_id;
cursor my_cur is
select /*+ use_hash(a,b) parallel(a,16) */ a.rowid row_id
from tabacca a
order by a.rowid;
begin
open my_cur;
loop
exit when my_cur%NOTFOUND;
fetch my_cur bulk collect into tb_row_id limit maxrows;
forall i in 1..tb_row_id.count
delete tabacca where id in(select id from temptablea where type='1') and rowid= tb_row_id(i);
commit;
end loop;
end;
DECLARE
x NUMBER;
BEGIN
FOR i IN 0 .. 9
LOOP
DBMS_JOB.submit (
x,
'begin DELETE tabacca t1
WHERE EXISTS
(SELECT 1
FROM (SELECT id
FROM (SELECT SUBSTR (TO_CHAR (ROWNUM), -1) rn,
id
FROM temptablea
WHERE TYPE = ''1'')
WHERE rn = '''
|| i
|| ''') t2
WHERE t2.id = t1.id);
COMMIT; end;'
);
END LOOP;
END;
declare
maxrows number default 1000;
tb_row_id type%tabacca.row_id;
cursor my_cur is
select a.rowid row_id
from tabacca a where exists (select 1 from temptablea b where a.id=b.id and b.type='1')
order by a.rowid;
begin
open my_cur;
loop
exit when my_cur%NOTFOUND;
fetch my_cur bulk collect into tb_row_id limit maxrows;
forall i in 1..tb_row_id.count
delete tabacca where rowid= tb_row_id(i);
commit;
end loop;
end;