For example, an exception-handling part could have this syntax: is one or more statements.

unhandled exception updating material-83unhandled exception updating material-59

While compiling stored PL/SQL units, the PL/SQL compiler generates warnings for conditions that are not serious enough to cause errors and prevent compilation—for example, using a deprecated PL/SQL feature.

To see warnings (and errors) generated during compilation, either query the static data dictionary view statement to disable all warning messages for the session and then compiles a procedure that has unreachable code. Next, the example enables all warnings for the session by invoking CREATE OR REPLACE PROCEDURE unreachable_code AUTHID DEFINER AS x CONSTANT BOOLEAN := TRUE; BEGIN IF x THEN DBMS_OUTPUT. PUT_LINE('FALSE'); END IF; END unreachable_code; / Exceptions (PL/SQL runtime errors) can arise from design faults, coding mistakes, hardware failures, and many other sources.

You cannot anticipate all possible exceptions, but you can write exception handlers that let your program to continue to operate in their presence.

Any PL/SQL block can have an exception-handling part, which can have one or more exception handlers.

Error-handling code is scattered throughout the program.

With exception handlers, you need not know every possible error or everywhere that it might occur.

You need only include an exception-handling part in each block where errors might occur.

If there is no handler for the exception, then PL/SQL returns an unhandled exception error to the invoker or host environment, which determines the outcome (for more information, see "Unhandled Exceptions").

Topics Using exception handlers for error-handling makes programs easier to write and understand, and reduces the likelihood of unhandled exceptions.