按顺序执行多个过程的存储过程 [英] Stored procedure to execute multiple procedures in a sequential order
问题描述
我需要通过在DBMS_Scheduler中进行调度,按顺序运行多个pl sql过程。我们可以通过调用所有这些proc来运行顺序顺序创建主进程来完成它,如果任何proc失败,执行就会停止
我还想捕获异常处理吗?
我尝试过:
创建或替换>
程序RUN_JOBS AS
BEGIN
PROCEDURE1 ;
PROCEDURE2;
PROCEDURE3;
PROCEDURE4;
程序5;
例外
当其他人的时候
dbms_output.put_line('error ::'|| SQLERRM);
err_num:= SQLCODE;
err_msg:= SUBSTR(SQLERRM,1,100);
插入tmp_log(no,err_message)值(1,SQLERRM);
END;
/
I have a requirement to run multiple pl sql procedures in a sequential order by scheduling in DBMS_Scheduler. Can we accomplish it by creating main proc by calling all these procs to run sequential order and the execution gets stopped if any of the proc gets failed 这篇关于按顺序执行多个过程的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
具有步骤的作业,以便您可以管理,如果之前的步骤失败,则停止执行后续步骤。
Also i'd like to capture the exception handling as well?
What I have tried:
CREATE OR REPLACE
PROCEDURE RUN_JOBS AS
BEGIN
PROCEDURE1;
PROCEDURE2;
PROCEDURE3;
PROCEDURE4;
PROCEDURE5;
exceptions
when others then
dbms_output.put_line('error::'||SQLERRM);
err_num := SQLCODE;
err_msg := SUBSTR(SQLERRM, 1, 100);
insert into tmp_log (no,err_message) values(1,SQLERRM);
END;
/You can simply create a SQL Job and add the steps into jobs and execute the Stored procedure in that. For error handling, you can use try & catch inside the stored procedure itself.
Job having steps so you can manage like if previous steps failed the stop executing the next steps.