Chapter 6. Condition Handling

In this chapter, you will learn

  • What SQLCODE and SQLSTATE are and their differences

  • What a condition handler is, how and when to best use it, its range and scope, and how to work with multiple handlers

  • How to force an application or user-defined exception, and set the appropriate message tag to go along with it

  • Various ways of returning errors, and how to check the success and/or failure of a stored procedure call

Any textbook that deals with the subject of writing code is not complete without a discussion on how to process errors and other conditions. Anticipating and handling conditions is part and parcel of good, robust programming style. With DB2 SQL procedures, this is accomplished through the use of condition handlers. In fact, it is often desirable to also be able to check for and act on warnings that may be encountered. With DB2 SQL procedures, warnings are also a type of condition, and thus warnings and errors are handled in a very similar fashion. This chapter will describe the various types of condition handlers and techniques of how and when to use them.

    DB2 SQL PL. Deployment and Advanced Configuration Essential Guide for DB2 UDB on Linux., UNIX, Windows, i5. OS, z. OS
    Intelligent Enterprises of the 21st Century
    ISBN: N/A
    EAN: 2147483647
    Year: 2003
    Pages: 205 © 2008-2017.
    If you may any questions please contact us: