CREATE_SCHEDULE v12

Use the CREATE_SCHEDULE procedure to create a job schedule. The signature of the CREATE_SCHEDULE procedure is:

CREATE_SCHEDULE(
  <schedule_name> IN VARCHAR2,
  <start_date> IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
  <repeat_interval> IN VARCHAR2,
  <end_date> IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
  <comments> IN VARCHAR2 DEFAULT NULL)

Parameters

schedule_name

schedule_name specifies the name of the schedule.

start_date

start_date is a TIMESTAMP WITH TIME ZONE value that specifies the date and time that the schedule is eligible to execute. If a start_date is not specified, the date that the job is enabled is used as the start_date. By default, start_date is NULL.

repeat_interval

repeat_interval is a VARCHAR2 value that specifies how often the job will repeat. If a repeat_interval is not specified, the job will execute only once, on the date specified by start_date.

Note: You must provide a value for either start_date or repeat_interval; if both start_date and repeat_interval are NULL, the server will return an error.

end_date

end_date is a TIMESTAMP WITH TIME ZONE value that specifies a time after which the schedule will no longer execute. If a date is specified, the end_date must be after the start_date. The default value is NULL.

Note: If a repeat_interval is specified and an end_date is not specified, the schedule will repeat indefinitely until it is disabled.

comments

Use the comments parameter to specify a comment about the schedule; by default, this parameter is NULL.

Example

The following code fragment calls CREATE_SCHEDULE to create a schedule named weeknights_at_5:

EXEC
  DBMS_SCHEDULER.CREATE_SCHEDULE (
    schedule_name    => 'weeknights_at_5',
    start_date       => '01-JUN-13 09:00:00.000000',
    repeat_interval  => 'FREQ=DAILY;BYDAY=MON,TUE,WED,THU,FRI;BYHOUR=17;',
    comments         => 'This schedule executes each weeknight at 5:00');

The schedule executes each weeknight, at 5:00 pm, effective after June 1, 2013. Since no end_date is specified, the schedule will execute indefinitely until it is disabled with DBMS_SCHEDULER.DISABLE.