9-6. Redirecting Control After an Exception Is Raised

Problem

After an exception is raised within an application, usually the statements within the exception handler are executed, and then control goes to the next statement in the calling program or outside the current code block. Rather than printing an error message and exiting your code block after an exception, you want to perform some further activity. For instance, let's say you are interested in logging the exception in a database table. You have a procedure for adding entries to the log table, and you want to make use of that procedure.

Solution

Invoke the procedure from within the exception handler. When the exception is raised, program control will be passed to the appropriate handler. ...

Get Oracle and PL/SQL Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.