假设我有一个过程如下:
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_error
和another_error
在同一个WHEN子句,因为它们的处理是相同的。
在Oracle中这可能吗?如果没有,还有什么其他可能性可以避免代码重复?