Pre-defined Exceptions:
Predefined exceptions are exceptions which are already defined through Oracle. The following list provides the set of Predefined Exceptions.
Advantages of Exceptions
By using exceptions for error handling has many advantages. Without exception handling, every time a command is issued and execution errors must be checked as given belows:
BEGIN
SELECT ...
-- check for 'no data found' error
SELECT ...
-- check for 'no data found' error
SELECT ...
-- check for 'no data found' error
The Error processing is not clearly divided from normal processing; nor is it robust. If you neglect to code a check then the error goes undetected and is likely to cause other seemingly unrelated errors.
With exceptions, errors can be conveniently handled without the requirement to code multiple checks, as given below:
BEGIN
SELECT ... SELECT ... SELECT...
...
Exception
WHEN NO_DATA_FOUND THEN # this exception catches all 'no data found' errors#
Exceptions improve readability through letting error-handling routines to be isolated. The Error recovery algorithms do not obscure the primary algorithm. An Exception also improves reliability. You need not to worry about checking for an error at every point it may occur. Just add an exception handler to your PL/SQL block. If the exception is ever raised in which block (or any sub-block) you can be sure it will be handled.