CRITICAL SKILL 6.5

Handle Error Conditions in PL/SQL

As we have seen in the previous section, bad things happen to good programs. However, you also have to deal with bad or problematic data as well. To deal with problems during the processing of data, PL/SQL provides us with the robust ability to handle these types of errors. We call this type of program code exception handling.

To raise an error from with in a PL/SQL program, use the built-in function named raise_application_error. The function requires two arguments. One is for the error number. This number must be between –20000 and –20999. The second argument is the error that you want the user to see.

As with all exception handling, this program code is placed into the EXCEPTION section ...

Get Oracle Database 10g: A Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.