This appendix introduced you to a subset of SQL PL called inline SQL PL, which is only used by DB2 UDB for Linux, UNIX, and Windows. It is used in dynamic compound SQL statements that can be executed as stand-alone code. Dynamic compound SQL statements can also be used in triggers, SQL UDFs, and SQL methods. Because inline SQL PL does not contain all the SQL PL elements, supported as well as unsupported SQL statements were highlighted. Even though only simple logic is allowed in inline SQL PL, you can extend the power of stored procedures by calling them from within dynamic compound SQL statements.

The appendix explained that utilizing compound statements helps to improve performance. With dynamic compound statements and SQL stored procedures, there are few things to consider when choosing one over the other. First, it is crucial to understand when the data access plan is generated. Secondly, determine whether the complexity of the logic can be handled by dynamic compound statements. If so, pay attention to the size of the SQL statements that are going to be embedded. Use stored procedures if it is large and complex.

A simple example of how to use inline SQL PL in stand-alone code was demonstrated here. For more practical examples of the language usage in UDFs and triggers, Chapter 9, "User-Defined Functions and Triggers," is a must-read.

    DB2 SQL PL. Deployment and Advanced Configuration Essential Guide for DB2 UDB on Linux., UNIX, Windows, i5. OS, z. OS
    Intelligent Enterprises of the 21st Century
    ISBN: N/A
    EAN: 2147483647
    Year: 2003
    Pages: 205 © 2008-2017.
    If you may any questions please contact us: