Leverage the power of SQL Procedural Language on DB2 for Linux, UNIX, Windows, i5/OS, and z/OS

Information, sample code, and sample chapter

Want to write portable and efficient SQL PL code on Linux, UNIX®, Windows®, i5/OS™, and z/OS®? Search no more, start with the new book - DB2 SQL PL: Essential Guide for DB2 UDB on Linux, UNIX, Windows, i5/OS, and z/OS.

DB2 PL 2nd Edition book team (db2sqlpl@ca.ibm.com)IBM Toronto Laboratory

Zamil Janmohamed, Clara Liu, Drew Bradstock, Raul Chong, Michael Gao, Fraser McArthur, and Paul Yip comprise the DB2 SQL PL 2nd Edition book team. They are all experienced in supporting DB2 application development for IBM business partners and individually have written many articles for developerWorks DB2.



16 December 2004

DB2 SQL Procedural Language

DB2 SQL Procedural Language (SQL PL) is a subset of the SQL Persistent Stored Modules (SQL/PSM) language standard. This standard is the basis for the structured programming languages used with SQL to write stored procedures, functions, triggers, and standalone code. Encapsulating complex business logic in database stored procedures can yield the following benefits:

  • Significantly improved application performance
  • Increased application scalability
  • Simplified application development
  • Reduced network traffic

The SQL/PSM standard combines the ease of data access of SQL with the flow control structures of a simple programming language. It gives developers the ability to create compound SQL statements and procedures that only need to be coded once to run on multiple platforms.


DB2 SQL PL: Essential Guide for DB2 UDB on Linux, UNIX, Windows, i5/OS, and z/OS

SQL PL book cover

Learning how to write SQL PL code that can run on DB2 for Linux, UNIX, Windows, i5/OS, and z/OS can improve the portability of your code. Read a sample chapter from the new book DB2 SQL PL: Essential Guide for DB2 UDB on Linux, UNIX, Windows, i5/OS, and z/OS.

Download Chapter 2 of the book and learn about the basic SQL procedure structure on all these platforms. In this chapter, you will learn:

  • The fundamental structure of an SQL procedure.
  • The various clauses for the CREATE PROCEDURE statement.
  • The structure of the procedure body.
  • The statements that can be coded in the procedure body.

Try the sample code

Download sample code for Chapter 2. Follow the examples and create the stored procedures in your own environment.

This edition of the book includes DB2 SQL PL improvements that will be introduced as part of the next point release of DB2 for Linux, Unix, and Windows, as well as the DB2 SQL PL implementation on i5/OS and z/OS. Various methods to resolve performance issues are introduced in the book. For example, you will learn how to monitor and identify bottlenecks and resolve them using a number of alternative methods.

This book teaches the reader through concrete examples and thorough discussions how to set up the development environment and use all the language elements of the latest SQL PL. Expert tips and best practices for achieving optimal performance and code manageability are also included. In addition, you'll find this book to be a valuable reference for SQL PL code syntax and troubleshooting.

Table of contents

  • Chapter 1: Introduction
  • Chapter 2: Basic SQL Procedure Structure
  • Chapter 3: Overview of SQL PL Language Elements
  • Chapter 4: Using Flow of Control Statements
  • Chapter 5: Understanding and Using Cursors and Result Sets
  • Chapter 6: Condition Handling
  • Chapter 7: Working with Dynamic SQL
  • Chapter 8: Nested SQL Procedures
  • Chapter 9: User-Defined Functions and Triggers
  • Chapter 10: Leveraging DB2 Application Development Features
  • Chapter 11: Deploying SQL Procedures, Functions, and Triggers
  • Chapter 12: Performance Tuning
  • Chapter 13: Best Practices
  • Appendix A: Getting Started with DB2
  • Appendix B: Inline SQL PL for DB2 UDB for Linux, UNIX, and Windows
  • Appendix C: Building from the Command Line
  • Appendix D: Using the DB2 Development Center
  • Appendix E: Security Considerations in SQL Procedures
  • Appendix F: DDL
  • Appendix G: Additional Resources
  • Appendix H: Sample Application Code

Updates, clarifications, and corrections

Click here for updates and corrections for the book DB2 SQL PL: Essential Guide for DB2 UDB on Linux, UNIX, Windows, i5/OS, and z/OS.

How to order

ISBN of this book is 0131477005. It can be ordered online from any major online bookseller, or from the IBM Book Store.


Downloads

DescriptionNameSize
Chapter 2Chapter2.pdf  ( HTTP | FTP )148 KB
Sample codesampleCode_Chapter2.zip  ( HTTP | FTP )7 KB

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Information management on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management
ArticleID=32368
ArticleTitle=Leverage the power of SQL Procedural Language on DB2 for Linux, UNIX, Windows, i5/OS, and z/OS
publish-date=12162004