下一个文件,如xxx.sql,如下:
set serveroutput on
declare
cursor call_ticket_cur//光标 is
select rowid from call_ticket10//表名 where state = '606';
curRec call_ticket_cur%rowtype;
record_count number(10);
begin
record_count := 0;
open call_ticket_cur;
loop
fetch call_ticket_cur into curRec;
exit when call_ticket_cur%notfound;
delete from call_ticket10 where rowid = curRec.rowid;
record_count := record_count + 1;
if mod(record_count,1000) = 0 then
commit;
end if;
end loop;
close call_ticket_cur;
dbms_output.put_line('Process records: '||record_count);
commit;
end;
/