PL/SQL Exceptions  «Prev  Next»

Lesson 4Handling predefined server exceptions
ObjectiveLearn how to handle predefined server exceptions.

Handling Predefined Server Exceptions

In the previous lesson, you learned about the two kinds of implicitly raised exceptions:
  1. Predefined server exceptions
  2. Non-predefined server exceptions

The Oracle server raises implicit exceptions at runtime--you do not have a choice in this matter. Oracle dictates the raising of such exceptions. However, you do need to write an error handing routine to handle these exceptions.
Handling predefined server exceptions is the easiest way to handle exceptions. The following MouseOver best explains how to code them.
predefined server cursor
  1. A predefined server cursor
  2. A sequence of statements
  3. A sequence of statements
  4. This might cause a 'No data found' error if there is no product with a product ID of 24 in the product table
  5. Exception handlers begin here
  6. Handles the 'No data found' error
  7. Handles all other errors

Predefined Server Exceptions
In the next lesson, you will learn about implicit user-defined exceptions.

Handling Predefined Server-Exceptions - Exercise

Click the Exercise link below to add exception handling to the PL/SQL block.
Handling Predefined Server-Exceptions - Exercise