Chapter 5

Handling Exceptions

In This Chapter

bullet Exploring exception basics

bullet Discovering types of exceptions

bullet Understanding how exceptions propagate

Almost any program has uncommon situations that need to be handled. These situations are sometimes caused by data entry problems. Imagine that a user enters several pieces of information into an online-book-order application. Maybe one or more pieces of information are missing or incorrectly entered. For example, in the case where the person forgot to indicate the shipping method on their order, the application responds with a user-friendly error message, such as You must enter a shipping method for your order. This is an example of user-defined exception handling in action.

You also want to have a nice way to handle programming errors and exceptions so that users don’t see incomprehensible messages such as Unhandled Program Exception — ORA 600. If you have ever encountered a message such as An unexpected program error has occurred. Please contact the help desk and report this problem, you have experience with a program where the designers tried to come up with a general way to handle unexpected situations.

In PL/SQL, you can handle these ...

Get Oracle PL/SQL For Dummies 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.