You use SET CATALOG to define the default database name for unqualified schema names that occur in statements subsequently prepared with PREPARE or EXECUTE IMMEDIATE. The default database name set with the precomiler option continues to be used to qualify unqualified schema names for all other statements. Until the time that the first SET CATALOG (or SET SCHEMA) statement is executed, the database name specified with the precompiler option is used as the default database name for all statements.
The defined default determined by SET CATALOG is revoked when the immediately following transaction - the current UTM transaction in the case of openUTM - is rolled back. This is also true if the transaction immediately following SET CATALOG only contains CALL DML statements. Otherwise the default database name you set with SET CATALOG is valid until a new database name is set with SET CATALOG or SET SCHEMA or until the end of the SQL session. You will find information on the general rules for implicit database and schema names in section "Qualified names".
The SET CATALOG statement does not initiate a transaction.
SET CATALOG
default_catalog
default_catalog ::= {
alphanumeric_literal | :
host_variable }
default_catalog
Name of the database to act as the default for the current SQL session.
alphanumeric_literal
The database name is specified as an alphanumeric literal (not in the hexadecimal format).
host_variable
The database name is specified as an alphanumeric host variable of the type CHAR or VARCHAR. The host variable cannot be a vector and cannot have an associated indicator variable.
Example
SET CATALOG 'ordercust'
See also
SET SCHEMA