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 Oracle Commands:

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 © 1999-2024 SS64.com
Some rights reserved