小编Pab*_*iva的帖子

单个“ when”子句可以在oracle中处理多种异常类型吗?

假设我有一个过程如下:

PROCEDURE proc_name (args)
IS

  --  declarations
    ...
BEGIN

    -- code
    ...
EXCEPTION

    WHEN an_error THEN

        --error handling code
         ....
        WHEN another_error THEN

        -- error handling code, identical to the one for an_error
         ...
     WHEN others THEN
       ---generic error handling code`
       ....
END;
Run Code Online (Sandbox Code Playgroud)

理想情况下,我希望能够赶上这两个an_erroranother_error在同一个WHEN子句,因为它们的处理是相同的。

在Oracle中这可能吗?如果没有,还有什么其他可能性可以避免代码重复?

oracle exception-handling exception

4
推荐指数
1
解决办法
841
查看次数

标签 统计

exception ×1

exception-handling ×1

oracle ×1