SAND CDBMS SQL Reference Guide


The SET SCHEMA statement changes the current schema for a particular database session.

Required Privileges

No special privileges are required to execute the SET SCHEMA command.


schema name

The schema name argument must be the name of an existing schema in the database. The named schema becomes the current, or implicit, schema for the session.


Any other SQL statements that follow the SET SCHEMA statement are executed within the context of the new current schema, unless they contain object names that are explicitly qualified by other schema names. The SET SCHEMA statement, therefore, changes the context in which SQL statements with unqualified object names are evaluated. The SET SCHEMA statement applies only to the database session from which it is issued.


The SET SCHEMA statement is used in this example to change the current schema to the schema called vip.


SELECT * FROM state;

This schema change makes the statement SELECT * FROM state equivalent to SELECT * FROM vip.state.