DB2® SQL PL: Essential Guide for DB2® UDB on Linux™, UNIX®, Windows®, i5/OS™, and z/OS®, Second Edition
by Zamil Janmohamed, Clara Liu, Drew Bradstock, Raul Chong, Michael Gao, Fraser McArthur, Paul Yip
Chapter 6. Condition Handling
In this chapter, you will learn
What
SQLCODEandSQLSTATEare and their differencesWhat 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. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access