Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>create_job</code> is the basic call to schedule a call. you don't have to create a named program or schedule to do this. where creating a named program/schedule is useful, is if you have several jobs that want to use this call. you can just reference the named program schedule instead of having each job hold a copy of that. </p> <p>e.g. if you had 5 jobs wanting to call your package <code>MYPKG.ENTRY_PROG(param)</code> and each job just used a different parameter value, i'd say you want to use <code>create_program</code> to define that pl/sql call and then <code>create_job</code> to reference that program name + set the parameter value of choice. that way, if you want to rename the API later or something, you don't have to change five seperate jobs to do this. </p> <p>If your job is just a standalone job that calls a routine that won't be called by other jobs, then you don't have to use <code>create_program</code>/<code>create_schedule</code>, just use <code>create_job</code> directly. </p> <p>one example where I used <code>create_program</code> was to call a test harness. my test harness package is called <code>pkg_test_harness.queue_tests(p_set_name in varchar2)</code> so I have a few jobs defined that enqueues various APIs to be run at 9AM, 12PM and 5PM. instead of defining each jobs call separately i just called <code>create_program</code> like:</p> <pre><code> dbms_output.put('Setting up TEST_HARNESS_ENQUEUE scheduler program...'); dbms_scheduler.create_program(program_name =&gt; 'TEST_HARNESS_ENQUEUE', program_type =&gt; 'STORED_PROCEDURE', program_action =&gt; 'pkg_test_harness.queue_tests', number_of_arguments =&gt; 1, enabled =&gt; false, comments =&gt; 'Program to enqueue a set of API test for the test harness to run.'); dbms_scheduler.define_program_argument(program_name =&gt; 'TEST_HARNESS_ENQUEUE', argument_name =&gt; 'p_set_name', argument_position =&gt; 1, argument_type =&gt; 'VARCHAR2', default_value =&gt; ''); dbms_scheduler.enable (name =&gt; 'TEST_HARNESS_ENQUEUE'); dbms_output.put_line('done.'); </code></pre> <p>and then each "job" was defined pointing to the program. </p> <pre><code>dbms_output.put('Setting up TEST_HARNESS_ENQUEUE_9AM scheduler job...'); dbms_scheduler.create_job(job_name =&gt; 'TEST_HARNESS_ENQUEUE_9AM', program_name =&gt; 'TEST_HARNESS_ENQUEUE', start_date =&gt; systimestamp, end_date =&gt; null, repeat_interval =&gt; 'freq=daily; byhour=9; byminute=0; bysecond=0;', enabled =&gt; true, auto_drop =&gt; false, comments =&gt; 'Job to enqueue a set of API test for the test harness to run.'); dbms_scheduler.set_job_argument_value(job_name =&gt; 'TEST_HARNESS_ENQUEUE_9AM', argument_position =&gt; 1, argument_value =&gt; 'DAILY_9AM'); dbms_output.put_line('done.'); dbms_output.put('Setting up TEST_HARNESS_ENQUEUE_12PM scheduler job...'); dbms_scheduler.create_job(job_name =&gt; 'TEST_HARNESS_ENQUEUE_12PM', program_name =&gt; 'TEST_HARNESS_ENQUEUE', start_date =&gt; systimestamp, end_date =&gt; null, repeat_interval =&gt; 'freq=daily; byhour=12; byminute=0; bysecond=0;', enabled =&gt; true, auto_drop =&gt; false, comments =&gt; 'Job to enqueue a set of API test for the test harness to run.'); </code></pre> <p>i didn't create a named schedule, as these schedules are unique to the individual job. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload