CURRENT SCHEMA

The CURRENT SCHEMA special register specifies a VARCHAR(128) value that identifies the schema name used to qualify unqualified database object references where applicable in dynamically prepared SQL statements.

CURRENT SCHEMA is not used to qualify names in programs where the DYNDFTCOL has been specified. If DYNDFTCOL is specified in a program, its schema name is used instead of the CURRENT SCHEMA schema name.1

The initial value of CURRENT SCHEMA is the authorization ID of the current session user.

The value of the special register can be changed by executing the SET SCHEMA statement. For more information, see SET SCHEMA.

The DFTRDBCOL keyword controls the schema name used to qualify unqualified database object references where applicable for static SQL statements.

Example

Set the schema for object qualification to 'D123'.

   SET CURRENT SCHEMA = 'D123'
1 For compatibility with DB2® for z/OS®, the special register CURRENT SQLID is treated as a synonym for CURRENT SCHEMA.