修改job的执行间隔时间:sys.dbms_job.interval()
马嘉楠 2008-3-18
假设,job已经存在,现在需要修改job的执行间隔 ,代码如下:
当然,第一步还是要查询job的ID
DECLARE
CURSOR c_job_id IS
SELECT job from user_jobs WHERE upper(what) ='P_NUMBER_RELEASE;' ;
BEGIN
FOR rec IN c_job_id LOOP
sys.dbms_job.interval(rec.job,interval => 'TRUNC(SYSDATE)+1' );
END LOOP;
COMMIT ;
END ;
/
--------------------------------------------------------------------------------------
以下转自:http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_job2.htm#1001106
--------------------------------------------------------------------------------------
INTERVAL Procedure
This procedure changes how often a job runs.
Syntax
DBMS_JOB.INTERVAL ( job IN BINARY_INTEGER, interval IN VARCHAR2);
Parameters
| Parameter | Description |
|---|---|
| job | Number of the job being run. |
| interval | Date function, evaluated immediately before the job starts running. |
Usage Notes
If the job completes successfully, then this new date is placed in next_date. interval is evaluated by plugging it into the statement select interval into next_date from dual;
The interval parameter must evaluate to a time in the future. Legal intervals include:
| Interval | Description |
|---|---|
|
| Run once a week. |
|
| Run once every Tuesday. |
|
| Run only once. |
If interval evaluates to NULL and if a job completes successfully, then the job is automatically deleted from the queue.
--------------------------------------------------------------------------------
本文介绍如何使用 Oracle 的 DBMS_JOB 包中的 INTERVAL 过程来更改任务的执行间隔时间。示例展示了如何将存储过程 P_NUMBER_RELEASE 的执行频率设置为每天一次。此外,文章还列举了合法的时间间隔表达式,例如每周运行一次或仅运行一次。
336

被折叠的 条评论
为什么被折叠?



