Step 2: Business Logic (PL/SQL) Enablement


After successfully enabling other vendor database schema to DB2, the second step is to
enable PL/SQL packages.


Business Problem: Encapsulating business logic written in different procedural languages in database application objects


Newer application models, application programming interfaces, and programming languages are often designed for reduce cost of creating and maintaining applications in n-tier architectures. Practical experience, however, has shown that isolating all business logic in the application layer does not necessary perform well. People soon realize that use of database application objects such as stored procedures, packages, user defined functions, and triggers bring them many benefits.


















Database application objects can be written in many programming languages: SQL procedural language, C, JAVA, or .NET. Among all, SQL procedural language is the most popular one because it combines the ease of data access of SQL with the flow control structures of a simple programming language.

All major database vendors support their own versions of an SQL procedural language. DB2's language is called DB2 SQL PL (SQL Procedural Language). Oracle's language is called PL/SQL (Procedural Language/Structured Query Language).


DB2 SQL PL and PL/SQL support


DB2 9.7 makes both SQL PL and PL/SQL both first class procedural languages in the database engine. No translation of PL/SQL is required. The source code remains as it is in the schema catalog just like SQL PL.









After the DB2 registry variable is set, DB2_COMPATIBILITY_VECTOR=ORA, PL/SQL code can be compiled and executed using any of the following DB2 interfaces: