Search code examples
oracleoracle11gjobsjob-schedulingdbms-scheduler

Job looping in Oracle scheduler


In oracle 11g, if I have a job A, is it possible to schedule it in such a way that, the job will repeatedly execute from 10am to 11am every day.


Solution

  • You can do as follows, the below will execute from 10 A.M. to 11 A.M. repeatedly every 10 minutes (change the frequency as per your requirement)

    BEGIN
       DBMS_SCHEDULER.create_job (
          job_name          => 'JOB_NAME',
          job_type          => 'PLSQL_BLOCK',
          job_action        => 'BEGIN your_procedure_name; END;',
          start_date        => SYSDATE,
          repeat_interval   => 'FREQ=DAILY; BYHOUR=10,11; BYMINUTE=0,10;',
          enabled           => TRUE,
          auto_drop         => FALSE);
    END;
    /
    

    "it should execute as much time as possible"

    Keep in mind, the job you are executing as much as possible during the one hour time should not be overkill