Name

EXC-00: Set guidelines for application-wide error handling before you start coding.

Synopsis

It’s impractical to define EXCEPTION sections in your code after the fact—in other words, after the programs have been written. The best way to implement application-wide, consistent error handling is to use a standardized package that contains at least the following elements:

  • Procedures that perform most exception-handling tasks, such as writing to an error log.

  • A raise program that hides the complexity of RAISE_APPLICATION_ERROR and application-specific error numbers.

  • A function that returns error message text for a given error number.

These ideas are covered in specific best practices in this chapter. A simple error-handling package may be found in the err.pkg file on the Oracle PL/SQL Best Practices web site.

Get Oracle PL/SQL Best Practices 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.