Skip to main content

skip to main content

developerWorks  >  Information Management  >

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

Information, sample code, and sample chapter

developerWorks
Document options

Document options requiring JavaScript are not displayed

Sample code


Rate this page

Help us improve this content


Level: Introductory

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

16 Dec 2004

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 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.



Back to top


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 1Introduction
Chapter 2Basic SQL Procedure Structure
Chapter 3Overview of SQL PL Language Elements
Chapter 4Using Flow of Control Statements
Chapter 5Understanding and Using Cursors and Result Sets
Chapter 6Condition Handling
Chapter 7Working with Dynamic SQL
Chapter 8Nested SQL Procedures
Chapter 9User-Defined Functions and Triggers
Chapter 10Leveraging DB2 Application Development Features
Chapter 11Deploying SQL Procedures, Functions, and Triggers
Chapter 12Performance Tuning
Chapter 13Best Practices
Appendix AGetting Started with DB2
Appendix BInline SQL PL for DB2 UDB for Linux, UNIX, and Windows
Appendix CBuilding from the Command Line
Appendix DUsing the DB2 Development Center
Appendix ESecurity Considerations in SQL Procedures
Appendix FDDL
Appendix GAdditional Resources
Appendix HSample 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.




Back to top


Downloads

DescriptionNameSizeDownload method
Chapter 2Chapter2.pdf148 KBFTP|HTTP
Sample codesampleCode_Chapter2.zip7 KBFTP|HTTP
Information about download methodsGet Adobe® Reader®


Resources



About the author

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.




Rate this page


Please take a moment to complete this form to help us better serve you.



 


 


Not
useful
Extremely
useful
 


Share this....

digg Digg this story del.icio.us del.icio.us Slashdot Slashdot it!



Back to top