Plsql Creating Oracle Timed Tasks
Original yxtic
Read Catalogue
- 1. Create a stored procedure for task execution, such as yxtestjob, inserting data into the test table
- 2, the timer corresponding to the Dbms_jobs folder, right-click New
- 3. Create a task
- Note: Timing execution and time interval description for job
- View Tasks
When using Oracle's most matching tool plsql, what if I create a timer with Plsql? Let me briefly describe how to create a timer using a tool:
1. Create a stored procedure for task execution, such as yxtestjob, inserting data into the test table
is begin insert into Ztest (name,createdate) values ('test', sysdate); end;
2, the timer corresponding to the Dbms_jobs folder, right-click New
Back to top 3, create a task
(1), in what value to fill in the stored procedure to be executed, multiple can, separate
(2), in the interval to fill in the Execution time strategy, (the specific wording as described below remarks)
Note: Timing execution and time interval description for job
The interval/interval is the interval between the last execution and the next execution, and when interval is set to NULL, the job execution ends and is removed from the queue. If we need the job to be executed periodically, use ' sysdate+m '.
(1). Execute Every Minute
Interval = TRUNC (sysdate, ' mi ') + 1/(24*60)
Hourly execution
Interval = TRUNC (sysdate, ' hh ') + 1/(24)
(2). Daily scheduled execution
Example: Daily 1 o'clock in the morning execution
Interval = TRUNC (sysdate+ 1) +1/(24)
(3). Regular weekly execution
For example: Every Monday 1 o'clock in the morning execution
Interval = TRUNC (Next_day (sysdate, ' Monday ')) +1/24
(4). Regular monthly execution
For example: 1st 1 o'clock in the morning every month to execute
Interval =>trunc (Last_day (sysdate)) +1+1/24
(5). Scheduled execution per quarter
For example, the first day of each quarter is 1 o'clock in the morning execution
Interval = TRUNC (Add_months (sysdate,3), ' Q ') + 1/24
(6). Every half-yearly scheduled execution
For example: Every July 1 and January 1 1 o'clock in the morning
Interval = Add_months (trunc (sysdate, ' yyyy '), 6) +1/24
(7). Scheduled execution every year
For example: January 1 1 o'clock in the morning every year to execute
Interval =>add_months (trunc (sysdate, ' yyyy '), 12) +1/24
View Tasks
If you want to see some scripts, you can also view them by opening folders, or by using more convenient SQL statements.
Note that if Next_date is 4000-1-1, the script is already in a stopped state.
Plsql Creating Oracle Timed Tasks