DB2 Version 10.1 for Linux, UNIX, and Windows

Built-in global variables expand SQL programming capabilities

Built-in global variables are global variables that are created with the database manager and are registered to the database manager in the system catalog.

The built-in global variables introduced in DB2®Version 10.1 are generated automatically during database creation. Once created, you can access the values of these global variables programmatically through SQL statements to share data without the need for additional application logic.

The following built-in global variables are now available.

CLIENT_HOST
This built-in global variable contains the host name of the current client, as returned by the operating system.
CLIENT_IPADDR
This built-in global variable contains the IP address of the current client, as returned by the operating system.
CLIENT_ORIGUSERID
This built-in global variable contains the original user identifier, as supplied by an external application such as an application server over an explicit trusted connection.
CLIENT_USRSECTOKEN
This built-in global variable contains a security token, as supplied by an external application such as an application server over an explicit trusted connection.
MON_INTERVAL_ID
This built-in global variable contains the identifier for the current monitoring interval.
PACKAGE_NAME
This built-in global variable contains the name of the currently executing package.
PACKAGE_SCHEMA
This built-in global variable contains the schema name of the currently executing package.
PACKAGE_VERSION
This built-in global variable contains the version identifier of the currently executing package.
ROUTINE_MODULE
This built-in global variable contains the module name of the currently executing routine.
ROUTINE_SCHEMA
This built-in global variable contains the schema name of the currently executing routine.
ROUTINE_SPECIFIC_NAME
This built-in global variable contains the specific name of the currently executing routine.
ROUTINE_TYPE
This built-in global variable contains the type of the currently executing routine.
TRUSTED_CONTEXT
This built-in global variable contains the name of the trusted context that was matched to establish the current trusted connection.