为什么dbms_job.submit在同一代码可以立即执行时不起作用? [英] why dbms_job.submit doesn't work while the same code work with execute immediate?
本文介绍了为什么dbms_job.submit在同一代码可以立即执行时不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我要使用dbms_job.submit的第一时间.
This is the frist time that I am going to use dbms_job.submit.
以下代码不起作用:
declare
i_job_no BINARY_INTEGER;
begin
dbms_job.submit(JOB => i_job_no, what => 'declare x number; begin x := f_threads(''my_program'', '|| 6058883 ||' , '|| 2 || '); end;', next_date => sysdate);
dbms_output.put_line(i_job_no);
end;
,但同样的事情可以立即执行.有人可以帮忙吗?!
but the same thing works fine with execute immediate. Can anyone help?!
> declare
i_job_no BINARY_INTEGER;
begin
execute immediate 'declare x number; begin x := f_threads(''my_program'', '|| 6058883 ||' , '|| 2 || '); end;';
end;
谢谢!
推荐答案
这样,您的pl/sql块将起作用:
in this way your pl/sql block will work:
declare
i_job_no BINARY_INTEGER;
begin
dbms_job.submit(JOB => i_job_no, what => 'declare x number; begin x := f_threads(''my_program'', '|| 6058883 ||' , '|| 2 || '); end;', next_date => sysdate);
dbms_output.put_line(i_job_no);
commit;
end;
您在代码中缺少commit
问候 乔娃
这篇关于为什么dbms_job.submit在同一代码可以立即执行时不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文