Example of using Oraclejob + Stored Procedure

Source: Internet
Author: User
Part 1: The following steps fully demonstrate the job creation process: Part 2: job-related knowledge: Part 3: Actual Application discovery: This is required when jobs are deleted.

Part 1: The following steps fully demonstrate the job creation process: Part 2: job-related knowledge: Part 3: Actual Application discovery: This is required when jobs are deleted.

Guidance:

Part 1: The following steps fully demonstrate the job creation process:

Part 2: job-related knowledge:

Part 3: Practical Application

We found that the job owner must be used to delete jobs, and sys cannot delete other jobs! (In this case, correct it later. Hey hey ·)

Body:

Part 1: The following steps fully demonstrate the jobCreation process:

1. Create a pig table with the Date Format

SQL> create table pig (a date );

Table created

SQL> commit;

Commit complete

2. Create a stored procedure. bb inserts data into the pig table.

SQL> create or replace procedure bb

2 begin

3 insert into pig values (sysdate );

4 end;

5/

Procedure created

3. Create a job named job2009 to execute the Stored Procedure bb every minute (60 × 24 = 1440.

SQL> variable job2009 number;

SQL> begin

2 dbms_job.submit (: job2009, 'bb; ', sysdate, 'sysdate + 1/1440 ');

3 end;

4/

Note: here the system automatically generates a job id of 41

PL/SQL procedure successfully completed

Job2009

---------

41

4. Run job2009.

SQL> begin

2 dbms_job.run (: job2009 );

3 end;

4/

PL/SQL procedure successfully completed

Job2009

---------

41

5. Delete job2009

SQL> begin

2 dbms_job.remove (: job2009 );

3 end;

4/

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.