- plsql中学习job
-
-
-
- create table test_job(para_datedate);
- commit;
-
- insert into test_jobvalues(sysdate);
- commit;
- select * from test_job;
-
-
-
-
- create orreplace procedure test_jobproce as
-
- begin
-
- insert into test_jobvalues(sysdate);
-
- end test_jobproce;
-
-
-
-
- declare test_job_really number;
- begin
- dbms_job.submit(test_job_really,'test_jobproce;',sysdate,'sysdate+1/1440');
- commit;
- end;
-
-
-
- begin
- dbms_job.broken(25,true);
- commit;
- end;
-
-
-
- begin
- dbms_job.run(25);
- commit;
- end;
-
-
-
-
- begin
-
- dbms_job.remove(25);
- commit;
- end;
-
-
- select * from test_joborder by test_job.para_datedesc;
-
-
- select * from sys.user_jobs
-
-
-
- select * from dba_jobs_running
-
-
-
-
- 除了submit参数外,其余的几个参数有:
-
- dbms_job.run(v_job); //运行job
-
- dbms_job.broken(v_job,true,next_date); //停止一个job,里面参数true也可是false,next_date(某一时刻停止)也可是sysdate(立刻停止)。
-
- dbms_job.remove(v_job); //删除某个job
-
- dbms_job.what(v_job,'sp_fact_charge_code;'); //修改某个job名
-
- dbms_job.next_date(v_job,sysdate); 修改下一次运行时间