DB2 SQL Procedural Language is an easy-to-learn language that can be used to write stored procedures, triggers, and user-defined functions in DB2. This comprehensive guide, written by experts who have worked with the language from the beginning, is filled with examples and tips to help you get started as quickly as possible.
DB2 SQL Procedural Language for Linux, UNIX, and Windows fills the need for a comprehensive guide on writing database applications using SQL Procedural Language (SQL PL). SQL PL is an easy-to-learn language that can be used to write stored procedures, triggers, and user-defined functions in DB2. Written by experts from the IBM Toronto Lab (where DB2 for Linux, UNIX, and Windows is developed) who have worked with the language from the beginning, this book is filled with examples and expert tips to help you get started as quickly as possible.
Chapter 1 - Introduction
Chapter 2 - Basic SQL Procedure Structure
Chapter 3 - Using Flow-of-Control Statements
Chapter 4 - Understanding and Using Cursors
Chapter 5 - Condition Handling
Chapter 6 - Working with Dynamic SQL
Chapter 7 - Working with Nested SQL Procedures
Chapter 8 - Leveraging DB2 Advanced Features
Chapter 9 - Deploying Stored Procedures
Chapter 10 - Working with Triggers and User-Defined Functions
Appendix A - Getting Started with DB2
Appendix B - Setting Up the Build Environment
Appendix C - Using the Development Center
Appendix D - Security Considerations in SQL Stored Procedures
Appendix E - Built-in Function Reference
Appendix F - DDL
Appendix G - Additional Resources
Appendix H - Sample Application Code for Receiving Cursor Result Sets
Appendix I - SQL PL Cross Platform Compatibility
You can order the book using the following ISBN: 0-13-100772-6
Sample download: Chapter 5. Exception Handling
In this chapter, you will learn:
- What SQLCODE and SQLSTATE are, and the differences between them.
- What a condition handler is, when to use it, and how to work with multiple handlers.
- How to force an application or user-defined error, and how to 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.
- DB2 SQL Procedural Language for Linux, UNIX, and Windows
- Using SQL Procedural Language for Triggers in DB2 UDB
- Advanced SQL Procedural Scripting in DB2 v7.2
- Cross-Platform DB2 Stored Procedures: Building and Debugging (Redbook)
| Description | Name | Size | Download method |
|---|---|---|---|
| Chapter in PDF format | ch05.pdf | 646 KB | FTP |
Information about download methods Get Adobe® Reader®
Hana Curtis has many years experience in relational database technology and is currently a member of the DB2 development team at the IBM Toronto Laboratory. In the past, she has worked at the DB2 Integration Center and also as a database consultant assisting IBM Business Partners to enable their applications to DB2. Hana has written several articles and is also one of the authors of the book DB2 SQL Procedural Language for Linux, UNIX, and Windows (Prentice Hall, 2003).
Michael Gao is a DB2 Consultant from the IBM Toronto Lab where DB2 for distributed platforms is developed. He currently primarily works with IBM business partners in performance tuning, application development, porting and customized education. He has presented at several international conferences and co-authored the book DB2 SQL Procedural Language for Windows, UNIX and Linux. You can reach Michael at xmgao at ca.ibm.com.
Clara Liu works as a DB2 UDB consultant at the IBM Toronto Laboratory. As a member of the Data Management Channel Development Team, she works closely with IBM business partners. Clara specializes in database application development and integration of new technologies with DB2. She teaches DB2 UDB certification courses to IBM business partners and at conferences. She co-authored several books which can be found at your favorite online bookstore.

Fraser McArthur is a consultant at the IBM Toronto Lab, where DB2 UDB for distributed platforms (Windows/Unix) is developed. He is a member of the Data Management Partner Enablement organization where he works with IBM Business Partners to migrate applications to DB2 and perform performance tuning. Fraser is a DB2 Certified Solutions Expert in both DB2 Administration and Application Development.

