【赛迪网-it技术报道】本文主要介绍了oracle数据库中job与存储过程的接合用法,具体示例请参考下文:
create or replace procedure tt is
begin
update infoopen
set checktype = 2
where floor(to_date(to_char(limittime, 'yyyy-mm-dd'),
'yyyy-mm-dd') -sysdate)<=5 and status<> 2 and checktype<>1; --显示即将超时
update infoopen
set isovertime = 1
where finishtime > limittime
and status = 2; --超时处理
update infoopen
set isovertime = 2
where finishtime < limittime
and status = 2; --没有超时处理
dbms_output.put_line('处理成功!');
end tt;
执行job
variable jobno number;
begin
dbms_job.submit(:jobno,'tt;',sysdate,'sysdate+1');
commit;
end;
/
begin
dbms_job.run(:jobno);
end;
/
移除job
exec dbms_job.remove(:job1);
exec dbms_job.remove(190);
commit;
/
查看job
select * from dba_jobs;
|