---------------------------------------------------------------------
--正点执行的job
---------------------------------------------------------------------
declare
v_jobno number;
begin
dbms_job.submit(v_jobno,
'&my_sp;',
trunc(sysdate, 'HH24')+1/24,
'trunc(sysdate, ''HH24'') + 1/24');
commit;
end;
/
---------------------------------------------------------------------
--半点执行的job
---------------------------------------------------------------------
declare
v_jobno number;
begin
dbms_job.submit(v_jobno,
'&my_sp;',
trunc(sysdate, 'HH24') + FLOOR(TO_NUMBER(TO_CHAR(sysdate, 'MI'))/30)/48+1/48,
'trunc(sysdate, ''HH24'') + 3/48');
commit;
end;
/
---------------------------------------------------------------------
--每周执行一次的job(周一早上10:00)
--trunc(sysdate, 'd')是将时间截断到本周周日(本周第一天)早上0点
---------------------------------------------------------------------
declare
v_jobno number;
begin
dbms_job.submit(v_jobno,
'&my_sp;',
trunc(sysdate, 'd') + 8 + 10/24,
'trunc(sysdate, ''d'') + 8 + 10/24');
commit;
end;
/