DB2 Version 10.1 for Linux, UNIX, and Windows

Functions (PL/SQL)

The DB2® data server supports the compilation and execution of scalar and pipelined PL/SQL functions. Scalar PL/SQL functions can be invoked in contexts where expressions are valid. When evaluated, a scalar PL/SQL function returns a value that is substituted within the expression in which the function is embedded. Pipelined PL/SQL functions can be invoked in the FROM clause of SELECT statements and compute a table one row at a time.

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.