Oracle job调用存储过程

时间:2024-03-28 13:37:32

在PL/SQL中的what值中直接写入存储过程的名称+“分号”;

begin
sys.dbms_job.submit(job => :job,
what => 'del_ky_items;',
next_date => to_date('24-06-2015 16:30:00', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'trunc(sysdate,''mi'')+1/24');
commit;
end;
/

如果有参数,使用两个单引号把字符串引起来;

都是不需要call语句的;

begin
sys.dbms_job.submit(job => :job,
what => 'del_ky_items(1,''a'',sysdate);',
next_date => to_date('24-06-2015 16:30:00', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'trunc(sysdate,''mi'')+1/24');
commit;
end;
/