本帖最后由 w252228767 于 2012-3-12 17:23 编辑
目前我是这样实现的
--写任务表job 8:30--18:30 每20秒运行一次
declare
job1 number;
begin
sys.dbms_job.submit(job => job1,
what => 'begin
if sysdate >= to_date(to_char(sysdate,''yyyy-mm-dd'')||'' 8:30'',''yyyy-mm-dd hh24:mi'' )
and sysdate <= to_date(to_char(sysdate,''yyyy-mm-dd'')||'' 18:30'',''yyyy-mm-dd hh24:mi'' ) then
p_h2k_test;
else
null;
end if;
end;',
next_date => sysdate+(60/86400),
interval => 'sysdate+(20/86400)');
commit;
end;
/
--写任务表job 非 8:30--18:30 每10分钟运行一次
declare
job1 number;
begin
sys.dbms_job.submit(job => job1,
what => 'begin
if sysdate >= to_date(to_char(sysdate,''yyyy-mm-dd'')||'' 8:30'',''yyyy-mm-dd hh24:mi'' )
and sysdate <= to_date(to_char(sysdate,''yyyy-mm-dd'')||'' 18:30'',''yyyy-mm-dd hh24:mi'' ) then
null;
else
p_h2k_test;
end if;
end;',
next_date => sysdate+(60/86400),
interval => 'sysdate+(600/86400)');
commit;
end;
这样就可以实现,而且很简单