【发布时间】:2018-01-12 11:08:41
【问题描述】:
我有检查程序:
PROCEDURE checkVariables
IS
r_Var1 exception;
r_Var2 exception;
BEGIN
If g_Name is null then
RAISE r_Var1;
End if;
If g_Prefix is null then
RAISE r_Var2;
End if;
DBMS_OUTPUT.PUT_LINE('Variables Set Up');
EXCEPTION
When r_Var1 then
DBMS_OUTPUT.PUT_LINE('Missing g_Name');
When r_Var2 then
DBMS_OUTPUT.PUT_LINE('Missing g_Prefix');
END;
如果引发异常,我还希望在消息旁边停止/中断所有其他 PL/SQL 代码(将不执行过程过程 3 和 4)。
喜欢:
execute procedure1
execute procedure2
execute checkVariables --raised exception, STOP/BREAK next code
execute procedure3
execute procedure4
我该怎么做?
【问题讨论】:
-
将它们包装在另一个过程中,将异常响应作为变量从过程中更改出来,根据变量在外部过程中引发异常
-
你能告诉我怎么做吗?
标签: oracle plsql exception-handling oracle12c