PL/SQL allows developers to raise and handle errors (exceptions) in a very flexible and powerful way. Each PL/SQL block can have its own exception section in which exceptions can be trapped and handled (resolved or passed on to the enclosing block). When an exception occurs (is raised) in a PL/SQL block, its execution section immediately terminates. Control is passed to the exception section. Every exception in PL/SQL has an error number and error message; some exceptions also have names.
Some exceptions have been predefined by Oracle in the STANDARD package or other built-in packages, such as UTL_FILE. See the following table for some of the most common predefined exceptions. You also can declare your own exceptions as follows:
An exception can be declared only once in a block, but nested blocks can declare ...