1擅这、創(chuàng)建存儲過程
create or replace procedure?P_DMI_AGENT?is?
begin?
delete DMI_AGENT;
insert into DMI_AGENT SELECT * FROM DMI_AGENT_v_sysdate;
insert into DMI_AGENT SELECT * FROM DMI_AGENT_v_sysdate1;
insert into DMI_AGENT SELECT * FROM DMI_AGENT_v_sysdate2;
insert into DMI_AGENT_LOG(dateid,taskno,successcnt)
values(to_number(to_char(sysdate, 'yyyymmdd')),'團(tuán)體人力推送接口','1');
exception when others then
insert into DMI_AGENT_LOG(dateid,taskno,successcnt)
values(to_number(to_char(sysdate, 'yyyymmdd')),'團(tuán)體人力推送接口','0');
end;
2狰住、創(chuàng)建執(zhí)行計劃
declare?
job integer;?
begin?
dbms_job.submit(job,'P_DMI_AGENT;',trunc(sysdate),'trunc(sysdate)+1');
commit;?
end;
3理疙、查詢計劃
SELECT j.JOB,j.LAST_DATE,j.LAST_SEC,j.NEXT_DATE,j.NEXT_SEC,j.interval,j.WHAT FROM?dba_jobs?j where j.WHAT = 'P_DMI_AGENT;';
4、刪除計劃
declare
jobno number;
begin
dbms_job.remove(123);
commit;
end;
注:其中‘123’是標(biāo)題3中的JOB字段的值烹植。