我有一个抛出此异常的程序
error_stack -> ORA-00030: El identificador de sesión del usuario no existe.
error_backtrace -> ORA-06512: en "OF_OWNER.GET_INVOICES", línea 46
call_stack -> ----- PL/SQL Call Stack -----
object line object
handle number name
00000010DB020548 59 procedure OF_OWNER.GET_INVOICES
000000112A537E58 2 anonymous block
但我不希望程序在这种情况下引发任何异常,我已经尝试了
...
WHEN 'ORA-00030' THEN
WHEN OTHERS
...
但是我收到了编译错误
答案 0 :(得分:2)
或者:
BEGIN
do something
EXCEPTION WHEN OTHERS THEN
IF SQLCODE = -30 THEN
NULL; -- ignore this particular exception
ELSE
RAISE; -- but throw the others
END IF;
END;
或者:
DECLARE
ORA00030 EXCEPTION; -- or any other name you like instead of ORA00030
pragma EXCEPTION_INIT(ORA00030, -30); -- link your exception name to the code
BEGIN
do something
EXCEPTION WHEN ORA00030 THEN
NULL; -- ignore this particular exception
END;