Summary


In this chapter, UDFs and triggers were discussed. DB2's support for advanced SQL PL logic in UDFs and triggers allows you to encapsulate both simple and complex logic at the database server to simplify application development.

Both scalar UDFs and table UDFs are illustrated by examples. UDFs can be directly used in the SQL statements. Invoking SQL procedures in UDFs enables you to use all DB2 SQL PL features directly or indirectly.

Triggers are an ideal mechanism to facilitate global enforcement of business logic for all applications and users. Examples of BEFORE, AFTER, and INSTEAD OF triggers were illustrated, and the purpose and limitations of using each type were discussed. Both UDFs and SQL procedures can be invoked in the triggers. Similarly, invoking SQL procedures in triggers enables you to use all DB2 SQL PL features directly or indirectly.

You should give extra attention when invoking SQL procedures from UDFs and triggers. The considerations for data access control, transaction control, and read and write conflicts should be carefully reviewed.



    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