问题描述
我有下面的程序,又称为另外两个程序。它调用并工作正常,但两个proc串行运行。我想并行运行它们,并在主procs光标上获得结果。我该怎么做?我尝试使用dbms_job.submit,但无法成功调用。如果可能,请告诉我。
t1是一个测试表,只有一个日期列插入时间,以检查调用是否在我使用dbms_job.submit时工作。dbms_lock.sleep是等待模仿一个长时间运行的过程。
t1是一个测试表,只有一个日期列插入时间,以检查调用是否在我使用dbms_job.submit时工作。dbms_lock.sleep是等待模仿一个长时间运行的过程。
create or replace procedure proc_Test_1(
in_CustomerId IN VARCHAR2,
in_Facility IN VARCHAR2 DEFAULT null,
out_Order_results OUT SYS_REFCURSOR,
out_Load_results OUT SYS_REFCURSOR) AS
BEGIN
dbms_output.put_line('1 '||systimestamp);
proc_Test_2(in_CustomerId, in_Facility, out_Order_results );
dbms_output.put_line('1.1 '||systimestamp);
proc_Test_3(in_CustomerId, in_Facility, out_Load_results );
dbms_output.put_line('1.2 '||systimestamp);
End proc_Test_1;
create or replace procedure proc_Test_2(
in_CustomerId IN VARCHAR2,
in_Facility IN VARCHAR2 DEFAULT null,
out_Order_results OUT SYS_REFCURSOR) AS
BEGIN
dbms_output.put_line('2 '||systimestamp);
open out_Order_results for select * from Table1 where rownum < 5;
insert into t1 values(sysdate);
commit;
DBMS_LOCK.SLEEP(10);
dbms_output.put_line('2.1 '||systimestamp);
End proc_Test_2;
create or replace procedure proc_Test_3(
in_CustomerId IN VARCHAR2,
in_Facility IN VARCHAR2 DEFAULT null,
out_Load_results OUT SYS_REFCURSOR) AS
BEGIN
dbms_output.put_line('3 '||systimestamp);
open out_Load_results for select * from Table2 where rownum < 5;
insert into t1 values(sysdate);
commit;
DBMS_LOCK.SLEEP(10);
dbms_output.put_line('3.1 '||systimestamp);
End proc_Test_3;
专家解答
您可以提交调度程序作业或使用DIY并行性同时运行这两个作业。但据我所知,这两个选项都没有给你一个方法来访问这些游标在调用过程中打开。
这就引出了一个问题:
为什么你想并行运行这些?
如果这些模仿真实的程序,基本上只是开放游标,这有什么帮助?
如果要减少总运行时间,您是否考虑过使每个过程更快?
这就引出了一个问题:
为什么你想并行运行这些?
如果这些模仿真实的程序,基本上只是开放游标,这有什么帮助?
如果要减少总运行时间,您是否考虑过使每个过程更快?
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




