create or replace procedure delete_mx_honey_data_log as
cursor c_rowid is select rowid from antispam.mx_honey_data_log where createtime < sysdate -1;
ids varchar2(32);
begin
open c_rowid;
loop
fetch c_rowid into ids;
exit when c_rowid%notfound;
delete from antispam.mx_honey_data_log where rowid=ids;
commit;
dbms_lock.sleep(0.25);
end loop;
exception
when others then
dbms_output.put_line('sqlcode-->' ||SQLCODE|| 'sqlerrm-->' ||SQLERRM);
end;
dbms_job.remove(42)
select * from user_jobs;
commit
declare job_delete_mx_honey_data_log number;
begin
dbms_job.submit(job_delete_mx_honey_data_log,'delete_mx_honey_data_log;',sysdate,'trunc(sysdate+4)');
end;
阅读(834) | 评论(0) | 转发(0) |