Chapter 9. User-Defined Functions and Triggers


In this chapter, you will learn

  • What User-Defined Functions (UDFs) are

  • How UDFs can be used to simplify your application development efforts

  • What triggers are

  • How triggers can be used to transparently and consistently enforce application logic in the database

UDFs and triggers are database objects that help reduce the complexity of database application development.

On LUW, although the language syntax for SQL PL is consistent for all types of objects from an application development perspective, the language implementation to support SQL PL for stored procedures is different from that for UDFs and triggers. SQL PL support in UDFs and triggers is a subset of that in stored procedures. It is referred to as the inline SQL PL.

Note

Although the UDFs and triggers are covered in this chapter, inline SQL PL is not discussed here. Appendix B, "Inline SQL PL for DB2 UDB for Linux, UNIX, and Windows," is fully dedicated to the topic and introduces how to implement stand-alone code as well.


On iSeries and zSeries, SQL UDFs and triggers are implemented just like SQL procedures. They are compiled during the creation process and the corresponding programs are executed when the objects are invoked.



    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