Search code examples
oracle-databaseeventsschedulerjobsschedule

Oracle Scheduler - can a single job be both event based and time based


Hi I am new to Oracle Scheduler. My question is - Can we give both repeat interval and event condition in the Schedule object for a single job?

I have this requirement in job scheduling - A job should run at a scheduled time, but only if a certain event has occured.

For eg.

Job1 should run - at 10 am every day - but only if same job from yesterday is not running anymore. (This I gonna figure out based on the table entry.) So the event gonna be a cell entry say 'ENDED' in the table job_statuses.

Would be easier if I can give both info in the same job. Else another approach I gonna try is - Schedule the job based on time. If the earlier instance is still running , reschedule the job based on event. But this looks clumsy.

Thanks in advance.

Mayank


Solution

  • I'd encode the condition in the PL/SQL of the procedure itself. i.e. it runs at 10am every day, but the first thing it does is check if the previous job had finished successfully.