Built-in functions

A function is an operation denoted by a function name followed by zero or more input values that are enclosed in parentheses. It represents a relationship between a set of input values and a set of result values. The input values to a function are called arguments.

The types of functions are aggregate, scalar, and table. A built-in function is classified as a aggregate function or a scalar function. A user-defined function can be a column, scalar, or table function.

If a column mask is used to mask the column values in the final result table and a column mask is applied to a column that is an argument for a function, the result of the function might be different because the column mask is applied to the column before the function operation can take place. For example, applying a column mask to column SSN can change the result of the aggregate function, COUNT(DISTINCT SSN).

Start of changeThe DISTINCT operation is performed on the unmasked column values. The keyword DISTINCT is not an argument of the function but rather a specification of an operation that is performed before the function is applied. If DISTINCT is specified, redundant duplicate values are eliminated before column mask is applied. If the column in aggregate function with DISTINCT keyword has column mask definition references columns that are non-grouping column and not the target column of the DISTINCT operation, the result of aggregate function can vary. Db2 does not guarantee the same row is returned from a group of duplicates in each execution, thus, the values in those non-DISTINCT/non-grouping columns in the returned row could be different each time.End of change

OLAP specification and functions
The RANK, DENSE_RANK, and ROW_NUMBER specifications are sometimes referred to as built-in 'functions'. Refer to OLAP specification for more information on these specifications.
Db2 MQSeries® functions
Db2 MQSeries functions integrate MQSeries messaging operations within SQL statements. The functions help you integrate MQSeries messaging with database applications. You can use the functions to access MQSeries messaging from within SQL statements and to combine MQSeries messaging with Db2 database access.

The functions can be scalar or table functions. For more information on using MQSeries functions, see the information on enabling MQSeries functions in Db2 Installation Guide and on programming techniques in Db2 Application Programming and SQL Guide.

Administrative task scheduler functions
The administrative task scheduler table functions provide information and status about the tasks that are scheduled to run using the administrative task scheduler. The administrative task scheduler provides the ability to run stored procedures, JCL jobs, and other administrative tasks according to a time or an event-based schedule. Refer to Db2 Administration Guide for additional information about the administrative task scheduler.