ORACLE-005: Create Job (a)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.