Special registers
A special register is a storage area that is defined for an application process by DB2® and is used to store information that can be referenced in SQL statements. A reference to a special register is a reference to a value provided by the current server. If the value is a string, its CCSID is a default CCSID of the current server.
The special registers can be referenced as follows:
>>-+-CURRENT APPLICATION ENCODING SCHEME---------------------------------+->< +-CURRENT CLIENT_ACCTNG-----------------------------------------------+ +-CURRENT CLIENT_APPLNAME---------------------------------------------+ +-CURRENT CLIENT_USERID-----------------------------------------------+ +-CURRENT CLIENT_WRKSTNNAME-------------------------------------------+ +-+-CURRENT DATE-----+------------------------------------------------+ | | (1) | | | '-CURRENT_DATE-----' | +-CURRENT DEBUG MODE--------------------------------------------------+ +-CURRENT DECFLOAT ROUNDING MODE--------------------------------------+ +-CURRENT DEGREE------------------------------------------------------+ +-CURRENT EXPLAIN MODE------------------------------------------------+ +-CURRENT GET_ACCEL_ARCHIVE-------------------------------------------+ | .-LOCALE-. | +-+-CURRENT--+--------+--LC_CTYPE-+-----------------------------------+ | '-CURRENT_LC_CTYPE--------------' | | .-TABLE-. .-FOR OPTIMIZATION-. | +-CURRENT MAINTAINED--+-------+--TYPES--+------------------+----------+ +-CURRENT MEMBER------------------------------------------------------+ +-CURRENT OPTIMIZATION HINT-------------------------------------------+ +-CURRENT PACKAGE PATH------------------------------------------------+ +-CURRENT PACKAGESET--------------------------------------------------+ +-+-CURRENT PATH-+----------------------------------------------------+ | '-CURRENT_PATH-' | +-CURRENT PRECISION---------------------------------------------------+ +-CURRENT QUERY ACCELERATION------------------------------------------+ +-CURRENT REFRESH AGE-------------------------------------------------+ +-CURRENT ROUTINE VERSION---------------------------------------------+ +-CURRENT RULES-------------------------------------------------------+ +-+-CURRENT SCHEMA-----+----------------------------------------------+ | | (1) | | | '-CURRENT_SCHEMA-----' | +-CURRENT SERVER------------------------------------------------------+ +-CURRENT SQLID-------------------------------------------------------+ +-+-CURRENT TIME-----+------------------------------------------------+ | | (1) | | | '-CURRENT_TIME-----' | | .-(--6--)-------. .-WITHOUT TIME ZONE-. | +-+-CURRENT TIMESTAMP-----+--+---------------+--+-------------------+-+ | | (1) | '-(--integer--)-' '-WITH TIME ZONE----' | | '-CURRENT_TIMESTAMP-----' | +-CURRENT TIME ZONE---------------------------------------------------+ +-SESSION TIME ZONE---------------------------------------------------+ | (2) | +-ENCRYPTION PASSWORD-------------------------------------------------+ '-+-SESSION_USER-+----------------------------------------------------' '-USER---------'
Notes:
- The SQL standard uses the form with the underline.
- The ENCRYPTION PASSWORD special register can only be explicitly referenced in the SET ENCRYPTION PASSWORD statement. It is used implicitly used by the encryption and decryption functions.