Other Schema Objects

1029阅读 0评论2009-07-07 lukeunique
分类:Oracle

■VIEW
 Syntax:
    ・CREATE [OR REPLACE] [FORCE | NOFORCE] VIEW
[schema.]viewname [(alias [,alias]…)]
AS subquery
[WITH CHECK OPTION [CONSTRAINT constraintname]]
[WITH READ ONLY [CONSTRAINT constraintname]] ;
      ・DROP VIEW [schema.]viewname ;
■SEQUENCE
 Syntax:
    ・CREATE SEQUENCE [schema.]sequencename
[INCREMENT BY number] [START WITH number] [MAXVALUE number | NOMAXVALUE] [MINVALUE number | NOMINVALUE] [CYCLE | NOCYCLE] [CACHE number | NOCACHE] [ORDER | NOORDER] ;
    ・ALTER SEQUENCE sequencename
[INCREMENT BY number]
[START WITH number]
[MAXVALUE number | NOMAXVALUE]
[MINVALUE number | NOMINVALUE]
[CYCLE | NOCYCLE]
[CACHE number | NOCACHE]
[ORDER | NOORDER] ;
■INDEX
 Types of Index:B*Tree,Bitmap...
■SYNONYMS
 Syntax:
   CREATE [PUBLIC] SYNONYM synonym FOR object ;
   DROP [PUBLIC] SYNONYM synonym ;
     ・ALTER SYNONYM synonym COMPILE;
Private synonyms are schema objects. Either they must be in your own schema, or they must be qualified with the schema name. Public synonyms exist independently of a schema. A public synonym can be referred to by any user to whom permission has been granted to see it without the need to qualify it with a schema name. Private synonyms must be a unique name within their schema(a namespace(table,views,sequence,private synonym)). Public synonyms can have the same name as schema objects. When executing statements that address objects without a schema qualifier, Oracle will first look for the object in the local schema, and only if it cannot be found will it look for a public synonym. Thus, in example, if the user happened to own a table called EMP it would be this that he would see—not the table pointed to by the public synonym.
Tips:The “public” in “public synonym” means that it is not a schema
object and cannot therefore be prefixed with a schema name. It does not mean that everyone has permissions against it.

To create a private synonym in your own schema, you must have the CREATE SYNONYM system privilege.
To create a private synonym in another user's schema, you must have the CREATE ANY SYNONYM system privilege.
To create a PUBLIC synonym, you must have the CREATE PUBLIC SYNONYM system privilege.

上一篇:DDL to Create and Manage Tables
下一篇:T1_Select