CREATE SCHEMA

Create multiple tables, views and grants in a single transaction.

Summary of Syntax:

   CREATE SCHEMA AUTHORIZATION schema options

   options
      CREATE TABLE
      CREATE VIEW
      GRANT

The schema name must be an existing Oracle username.

Example:
   CREATE SCHEMA AUTHORIZATION painter
     CREATE TABLE paint
        (paint_id NUMBER PRIMARY KEY,
         paint_size NUMBER,
         colour VARCHAR2(10) )

     CREATE VIEW large_paints AS 
         SELECT paint_id,colour FROM paint WHERE paint_size=100

     GRANT select ON large_paints TO scott;

This command (along with create user) is typically used to setup a new, empty set of tables and views. An alternative method is to use export and import (EXP and IMP)

"In the small matters trust the mind, in the large ones the heart" ~ Sigmund Freud

Related:

CREATE USER

 DBA_ALL_TABLES  ALL_ALL_TABLES   USER_ALL_TABLES
 DBA_TABLES      ALL_TABLES       USER_TABLES   TAB
 DBA_USERS       ALL_USERS        USER_USERS
 DBA_VIEWS       ALL_VIEWS        USER_VIEWS


© Copyright SS64.com 1999-2014
Some rights reserved