Usage of dbms_job.submit in Oracle

Source: Internet
Author: User

Usage Demo:
Dbms_job.submit (: jobno, // job no.
'Your _ procedure; ', // process to be executed
Trunc (sysdate) + 1/24, // next execution time
'Trunc (sysdate) + 1/24 + 1' // Interval
);
Delete job: dbms_job.remove (jobno );
Modify the operation to be executed: Job: dbms_job.what (jobno, what );
Modify the next execution time: dbms_job.next_date (job, next_date );
Interval of modification: dbms_job.interval (job, interval );
Stop job: DBMS. Broken (job, broken, nextdate );
Start Job: dbms_job.run (jobno );

Appendix: Call statements and parameter descriptions:

Dbms_job.submit (job out binary_integer,

What in archar2,
Next_date in date,
Interval in varchar2,
No_parse in Boolean)
Where:
● Job: output variable, which is the number of the task in the task queue;
● What: the name of the task to be executed and its input parameters;
● Next_date: the time when the task is executed;
● Interval: The interval between tasks.

Demo example:

Declare
Jobid number;
V_ SQL varchar2 (2000 );
Begin
V_ SQL: = 'begin'
If to_char (sysdate, ''hh24: mi'') = ''15: 30 ''then -- execute
Insert into CK. rkjl (cksj) Select cksj from wzcs. ckjl;
Dbms_output.put_line (''serted success '');
End if;
Commit;
Exception
When others then
Rollback;
Dbms_output.put_line (sqlerrm );
End;
';

Dbms_job.submit (jobid, v_ SQL, sysdate, 'sysdate + 1/1440 ');

Dbms_job.run (jobid );

Dbms_output.put_line ('job' | to_char (jobid) | 'Is running ');

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.