Oracle的定时器使用示例

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

--Oracle定时job
--数据库执行此脚本时时,请确保只执行一次,否则会引发错误!
declare job_id number;  
begin  
dbms_job.submit(job_id,'Reinsure_Writeback_Opdate;',sysdate,'sysdate+1/(24*60)');  
commit;  
END;
/

--存储过程
create or replace procedure Reinsure_Writeback_Opdate as
begin
  update WEB_RI_SETT_MAIN B
     set B.C_RP_FLAG =
         (select case
                   when C.OPDATE is null then
                    '0'
                   else
                    '1'
                 end
            from web_fin_write_back C
           where C.BATCHNO = B.C_SETT_NO)
   where exists
   (select 1 from web_fin_write_back C where C.BATCHNO = B.C_SETT_NO);
   commit;
end Reinsure_Writeback_Opdate;