set serveroutput on;
declare
start_date timestamp with time zone;
return_date_after timestamp with time zone;
next_run_date timestamp with time zone;
begin
start_date := cast(sysdate as timestamp with time zone);
for i in 1 .. 8 loop
return_date_after := nvl(next_run_date, start_date);
dbms_scheduler.evaluate_calendar_string(
calendar_string => 'sched_1,sched_2',
start_date => start_date,
return_date_after => return_date_after,
next_run_date => next_run_date);
dbms_output.put_line('Will run at: '
|| to_char(next_run_date, 'YYYY-MM-DD HH24:MI:SS'));
end loop;
end;
/
Will run at: 2014-04-08 16:00:18
Will run at: 2014-04-08 18:30:18
Will run at: 2014-04-09 12:00:18
Will run at: 2014-04-09 16:00:18
Will run at: 2014-04-09 18:30:18
Will run at: 2014-04-10 12:00:18
Will run at: 2014-04-10 16:00:18
Will run at: 2014-04-10 18:30:18
1 回答
如果您不想创建两个作业,最简单的方法是创建两个计划 . 您可以通过Schedules-> New Schedule上下文菜单项或从工作表执行此操作:
然后在作业向导中,将'Repeat Interval'设置为
SCHED_1,SCHED_2
. 当然,你可能想要使用更有意义的名字......您可以检查合并计划何时运行 - 在当前时间之后 - 使用以下内容: