Chapter 7. Working with Dynamic SQL


In this chapter, you will learn

  • The two phases of processing an SQL statement

  • The difference between dynamic SQL and static SQL

  • When and how to use dynamic SQL with the EXECUTE IMMEDIATE statement

  • When and how to use dynamic SQL with PREPARE and EXECUTE

  • The use of dynamic SQL in cursors

  • How to use dynamic CALL statements

  • The use of dynamic SQL for DDL

  • How to use the escape character in dynamic SQL

  • How to use the package cache

Dynamic SQL is a method of SQL programming that allows you to write robust and flexible code. So far, only static SQL has been used in our SQL procedures, and the distinction between dynamic SQL and static SQL has not been made. At this stage, you may not even know that SQL can be classified as static or dynamic, but don't worrysuch details will be covered first. Then, this chapter will discuss the different ways of using dynamic SQL in SQL procedures. Then we will highlight restrictions and advanced techniques of using dynamic SQL.



    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

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net