How to automatically execute the oracle stored procedure once a day

Source: Internet
Author: User

How to automatically execute the oracle stored procedure every day and call the stored procedure with the joboracle timer 1. create a table. To see the running status of the timer clearly, create a table SQL code with a date field: create table job_table (run_time date); www.2cto.com create table job_table (run_time date ); 2. create a Stored procedure SQL code create or replace procedure job_proc is begin insert into job_table (run_time) values (sysdate); end; create or replace procedure job_proc isbegininsert into job_table (run_time) values (sysdate); end; 3. create a job and run the SQL code declare job number once per minute; begin dbms_job.submit (job, 'job _ proc; ', sysdate, 'trunc (sysdate, 'mi '') + 1/(24*60) '); end/commit; declarejob number; begindbms_job.submit (job, 'job _ proc;', sysdate, 'trunc (sysdate, ''mi'') + 1/(24*60) '); end/commit; 4. after the job is created, it is automatically running. Let's query the job table and check the created job SQL code select job, broken, what, interval, t. * from user_jobs t; select job, broken, what, interval, t. * from user_jobs t; job broken what interval... 81 N job_proc; TRUNC (sysdate, 'mi') + 1/(24*60 )... this parameter describes the unique identifier of a job, whether the automatically generated broken is in the running state, N; run; Y: Stop what stored procedure name interval defined execution time www.2cto.com supplement: description INTERVAL parameter value: ''trunc (SYSDATE + 1) ''08:30 every day at midnight ''' TRUNC (SYSDATE + 1) + (8*60 + 30) /(24*60) '''next _ DAY (TRUNC (SYSDATE), '''tuesday '''') + 12/24 '''midnight on the first day of each month ''' TRUNC (LAST_DAY (SYSDATE) + 1) '''trunc (ADD_MONTHS (SYSDATE + 2/24, 3), ''q '') -1/24 ''TRUNC (LEAST (NEXT_DAY (SYSDATE, '''saturday"), NEXT_DAY (SYSDATE, "SUNDAY "))) + (6 × 60 + 10)/(24 × 60) ''<script> </script>

Related Article

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.