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
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.
|Chapter 2||Chapter2.pdf ( HTTP | FTP )||148 KB|
|Sample code||sampleCode_Chapter2.zip ( HTTP | FTP )||7 KB|
- First edition of the DB2 SQL PL book.
- Download the latest FixPak: DB2 Support Home Page. (If you are already using DB2 V8.1.x, you can apply FixPak 7 to update software to V8.2).
- DB2 UDB Online Documentation (INFOCenter) is a resource for all kinds of information about DB2 UDB V8.2.