SET SCHEMA

Set default schema(s) for unqualified objects.

set_schema.png

 

Usage

Embedded, Interactive, Module, ODBC, JDBC.

Description

With SET SCHEMA, one or several default schemas can be specified. For lookup of unqualified object names, the different schemas are tried in order until an existing object is found.

When creating an object, the first schema name is used.

Example

The different schemas are tried in order until an existing table TBL is found:

SET SCHEMA MARY, DEVTEAM;

SELECT * FROM TBL; -- First try MARY.TBL, if it doesn’t exist try DEVTEAM.TBL

 

The first schema name is used when creating a new object:

SET SCHEMA MARY, DEVTEAM;

CREATE SEQUENCE SEQ; -- Create MARY.SEQ

Standard Compliance

Standard

Compliance

Comments

SQL-2016

Features outside core

The SET SCHEMA statement is a part of Feature F761, “Session management”.

 

Mimer SQL extension

The option to specify more than one schema is a Mimer SQL extension.