CREATE SCHEMA (Define schema)
Function
CREATE SCHEMA defines a schema.
Privileges
- Users with the schema definition privilege
These users can define schemas for themselves only.
- Users with the DBA privilege
Can define schemas of other users who have the CONNECT or DBA privilege.
Format
CREATE SCHEMA schema-name-clause
schema-name-clause::=[AUTHORIZATION authorization-identifier]
Operands
- [AUTHORIZATION authorization-identifier]
Specifies the authorization identifier of the user for whom a schema is to be defined. The default is the executing user's own authorization identifier.
Notes
- Once a schema has been defined, tables, indexes, abstract data types, index types, functions, procedures, triggers, and access privileges can be defined.
- Only one schema can be defined for each user.
- The authorization identifier specified as the owner of a table or an index must be the same authorization identifier specified in the schema definition for that user.
- A user who receives a schema defined for that user by a user with the DBA privilege is granted the schema definition privilege.
- The CREATE SCHEMA statement cannot be specified from an X/Open-compliant UAP running under OLTP.
Example
Define a schema for a user (USER1):
CREATE SCHEMA
AUTHORIZATION USER1