Job is used in a lot of practical applications. Regular users perform certain functions, stored procedures, and so on. Here's a look at how to create and start a job.
For example, a stored procedure is executed using a job schedule.
Stored Procedure name: Pro_test_job
Execution interval: 2 hours,
The SQL statements are as follows
Declare job number ; V_count number;begin SELECT Count (*) into v_count from user_jobs uj WHERE upper (uj.what) = UPPER (' pro_test_job; '); If V_count = 0 Then sys.dbms_job.submit (Job + job, what = ' pro_test_job; ', next_date = Sysdate, interval = ' sysdate+2/24 '); Dbms_job.run (Job); commit; End If;end;
Here are a few main parameters to illustrate.
Job-refers to the job ID, which is automatically generated.
What-job content, if the job with the parameter, here can be a script.
next_date-the next execution time.
interval-the frequency of execution.
Here is the job without parameters, if you need to input parameters how to write SQL, please see the next article.
ORACLE-005: Create Job (a)