Name
CREATE SCHEMA
Synopsis
CREATE SCHEMA AUTHORIZATIONschema
[CREATE TABLEcommand
] [CREATE VIEWcommand
] [SQL_TRACE = {TRUE | FALSE} ] [GRANTcommand
]
Creates multiple tables and views and performs multiple grants in a single transaction.
Keywords
- CREATE TABLE
A CREATE TABLE command (described later in this chapter).
- CREATE VIEW
A CREATE VIEW command (described later in this chapter).
- SQL_TRACE
Controls whether performance statistics will be generated. The initial value is set in the INIT.ORA file.
- GRANT
A GRANT command (described later in this chapter).
Notes
You must have the same privileges required for the CREATE TABLE, CREATE VIEW, and GRANT commands in order to issue this command. Individual commands within the CREATE SCHEMA command must not be terminated with the SQL termination character.
Example
The following example creates a schema for scott consisting of a table and a view, and grants privileges on the view to a role:
CREATE SCHEMA AUTHORIZATION scott CREATE TABLE dept ( deptno NUMBER NOT NULL, dname VARCHAR2(20), location VARCHAR2(15), avg_salary number (9,2)) CREATE VIEW deptview AS SELECT deptno,dname,location FROM dept GRANT SELECT ON deptview to non_admin
Get Oracle Database Administration: The Essential Refe now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.