A simple example of calling a scheduled task in Oracle

Source: Internet
Author: User

1. Create a test table

Create Table g_test

(
ID number (12 ),
C_date date

);

2. Create a stored procedure

Create or replace procedure prc_g_test is
Begin
Insert into g_test values (seq_cam_action_id.nextval, sysdate );
End prc_g_test;

3. Create a scheduled task

PLSQL defines job:

Declare
Job number;
Begin
SYS. dbms_job.submit (job, 'prc _ g_test; ', sysdate, 'sysdate + 100 ');
End;

Command Line definition job:

Variable job1 number;

Begin

SYS. dbms_job.submit (job =>: job1,
What => 'prc _ g_test ;',
Next_date => to_date ('22-10-2008 10:06:41 ', 'dd-mm-yyyy hh24: MI: ss '),
Interval => 'sysdate + 100'); -- 1/1440 minutes a day, that is, once a minute to run the test process
Commit;

End;
/

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.