oracle job使用
-- 查询job --
select job, what, next_date, next_sec, sysdate, failures, broken,interval from user_jobs a;
-- 创建job --
DECLARE job_country_warnRecord NUMBER;
begin
dbms_job.submit(job => job_country_warnRecord,
what => 'WARNRECORD_PKG.proc_timerTask_warnRecord;',
next_date => TRUNC(SYSDATE)+8/24,
interval => 'TRUNC(sysdate) + 1 +8/(24)');
commit;
end;
begin
sys.dbms_job.submit(job => :job,
what => 'tc_proc;', //要执行的存储过程
next_date => to_date('09-03-2013 00:01:00', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'TRUNC(sysdate+1)+(00*60+01)/(24*60)'); //什么时候执行
commit;
end;
/
-------------删除JOB-----------------
begin
dbms_job.remove(41); //41为Job 的ID值
end;