1

I have multiple schedules and I want to supply all of them to the repeat_interval of a job. However, I can't find a way to do this - Oracle documentation says it's possible, but I can't find any examples. Any help is appreciated. This is what I tried, but it doesn't work:

ORA-06512: at line 2 27418. 00000 - "syntax error in repeat interval or calendar"

*Cause: The repeat interval or calendar definition was not recognized as valid syntax.

begin
    dbms_scheduler.create_schedule('SCHED1', 
          repeat_interval => 'FREQ=DAILY;BYHOUR=9;BYMINUTE=55');
    dbms_scheduler.create_schedule('SCHED2', 
          repeat_interval => 'FREQ=DAILY;BYHOUR=15;BYMINUTE=15'); 
    DBMS_SCHEDULER.CREATE_JOB(
          JOB_NAME           =>  'SCHED_TEST_JOB',
          JOB_TYPE           =>  'STORED_PROCEDURE',
          JOB_ACTION         =>  'SCHED_TEST_JOB_PROCEDURE',
          START_DATE         =>  SYSDATE,
          REPEAT_INTERVAL    =>  'FREQ=SCHED1,SCHED2;',
          AUTO_DROP          =>  FALSE,
          ENABLED            =>  FALSE);
end;
/
charlie
  • 45
  • 6

2 Answers2

0

I think you have an excess semicolon on the end of your create_job repeat interval.

The syntax is:

combined_schedule = schedule_list [";" include_clause][";" exclude_clause] [";" intersect_clause]

... where schedule_list is:

schedule_list = schedule_clause ("," schedule_clause)
David Aldridge
  • 51,479
  • 8
  • 68
  • 96
0

Are you looking to combine the schedules like this:

SQL>  BEGIN
  2    dbms_scheduler.create_schedule('sched1',
  3            repeat_interval => 'FREQ=YEARLY;
  4                                BYDATE=0130,0220,0725');
  5    dbms_scheduler.create_schedule('sched2',
  6           repeat_interval => 'FREQ=MONTHLY;
  7                               INTERVAL=2;
  8                               BYMONTHDAY=15;
  9                               BYHOUR=9,17;
 10                               INCLUDE=sched1');
 11  END;
 12  /

PL/SQL procedure successfully completed.

SQL> BEGIN
  2  DBMS_SCHEDULER.create_job (
  3       job_name      => 'test_sched_job_definition',
  4       schedule_name => 'sched2',
  5       job_type      => 'PLSQL_BLOCK',
  6       job_action    => 'BEGIN DBMS_STATS.gather_schema_stats(''SCOTT''); END;',
  7       enabled       => TRUE,
  8       comments      => 'Job defined by existing schedule and inline program.');
  9  END;
 10  /

PL/SQL procedure successfully completed.
Lalit Kumar B
  • 47,486
  • 13
  • 97
  • 124