③. Submitting a Job to the Job Queue 向任务队列提交一个任务
To submit a new job to the job queue, use the SUBMIT procedure in the DBMS_JOB package:
DBMS_JOB.SUBMIT( job OUT BINARY_INTEGER,
what IN VARCHAR2,
next_date IN DATE DEFAULT SYSDATE,
interval IN VARCHAR2 DEFAULT 'null',
no_parse IN BOOLEAN DEFAULT FALSE)
job:输出变量,是此任务在任务队列中的编号;
what:执行的任务的名称及其输入参数;
next_date:任务执行的时间;
interval:任务执行的时间间隔。
例:某一时刻开始,每隔1分钟执行一次
VARIABLE jobno number;
BEGIN
DBMS_JOB.SUBMIT(:jobno, 'prc_test(sysdate);', to_date('20060214 11:40:00','yyyymmdd hh24:mi:ss') , 'SYSDATE + 1/1440');
COMMIT;
END;
④. DBMS_JOB 包介绍
Procedure Description Described
SUBMIT Submits a job to the job queue. 向任务队列提交一个任务
REMOVE Removes a specified job from the job queue. 从任务队列中删除指定的任务
CHANGE Alters a specified job. You can alter the job description, the time at which the job will be run, or the interval between executions of the job. 改变任务
WHAT Alters the job description for a specified job. 改变指定任务的任务内容
NEXT_DATE Alters the next execution time for a specified job. 改变指定任务的下一次执行时间
INTERVAL Alters the interval between executions for a specified job. 改变指定任务的执行时间间隔。
BROKEN Disables job execution. If a job is marked as broken, Oracle does not attempt to execute it. 禁止指定任务的执行
RUN Forces a specified job to run. 强制执行指定的任务