Advantages of Exceptions
Using the exceptions for the error handling has many benefits. Without an exception handling, every time you issue a command, you should ensure for the execution errors:
-- check for 'no data found' error
The Error processing is not clearly separated from general processing; nor is it robust. If you ignore to code a check, the error goes unobserved and is possible to cause other, apparently unrelated errors. With the exceptions, you can handle errors correctly without the requirement to code the multiple checks, which is as shown:
WHEN NO_DATA_FOUND THEN -- catches all 'no data found' errors
The Exceptions improve readability by letting you isolate the error-handling routines. The primary algorithm is not covered by error recovery algorithms. The Exceptions also improve reliability. You do not need to worry about checking for an error at every point it might occur. An exception handler is just adding to your PL/SQL block. If the exception is still raised in that block or any sub-block, you can be definite it will be handled.