DB2 Version 9.7 for Linux, UNIX, and Windows

Functions (PL/SQL)

The DB2® data server supports the compilation and execution of PL/SQL functions. PL/SQL functions are database objects that contain PL/SQL procedural logic and SQL statements that can be invoked in contexts where expressions are valid. When evaluated, a PL/SQL function returns a value that is substituted within the expression in which the function is embedded.

PL/SQL functions are created by executing the CREATE FUNCTION statement. Such functions can be dropped from the database by using the DB2 SQL DROP statement. If you want to replace the implementation for a function, you do not need to drop it. You can use the CREATE FUNCTION statement and specify the OR REPLACE option to replace the function implementation.