Skip to content

One Custom Event raises a specific known error via error_sys.record_general, and a separate Custom Event that changes the same object's status might trigger that error indirectly. Is it possible for the second event to catch and specifically handle that particular known error, rather than just blindly catching every possible exception with a generic WHEN OTHERS?

Answer

Yes — a specific, known error can be caught and handled distinctly, rather than just via a generic WHEN OTHERS, provided that specific error is first associated with a declared exception name and its specific error number using PL/SQL's PRAGMA EXCEPTION_INIT mechanism. Declare a named exception, associate it with the specific Oracle error number the other event's error surfaces as (a numbered ORA-20xxx-style user-defined exception), and then catch that SPECIFIC named exception, rather than a blanket WHEN OTHERS, in your own event's exception-handling block — this lets you distinguish and specifically react to that one known error rather than blindly catching every possible exception the same way.

← Browse Developer Studio, deployment, and upgrades questions