CREATE VIEW

Create a view.

Syntax:

   CREATE [OR REPLACE] [FORCE|NOFORCE] VIEW
     [schema.]view 
       [(alias,…) inline_constraint(s)]
       [out_of_line_constraint(s)]
       [XMLType_view_clause]
          AS subquery options 

Object View:
   CREATE [OR REPLACE] [FORCE|NOFORCE] VIEW
     [OF [schema.] type_name
        {WITH OBJECT IDENTIFIER {DEFAULT|(attribute,…) |
        UNDER SCHEMA.superview }
        ([out_of_line_constraint(s)]
            attribute inline_constant(s))
            AS subquery options

options:
   WITH READ ONLY
   WITH CHECK OPTION [CONSTRAINT constraint]

XMLType_view_clause:
   OF XMLTYPE [XMLSCHEMA XMLSchema_URL] ELEMENT element
     WITH OBJECT IDENTIFIER {DEFAULT | (expr,…)}

   OF XMLTYPE [XMLSCHEMA XMLSchema_URL] ELEMENT XMLSchema_URL#element
     WITH OBJECT IDENTIFIER {DEFAULT | (expr,…)}

Examples

CREATE VIEW discography
AS
Select t_artists.artist_name, t_albums.album_name
From t_artists, t_albums
Where t_artists.artist_id = t_albums.artist_id;

Select artist_name, album_name from discography;

“Like tourists huffing and puffing to reach the peak we forget the view on the way up” - Friedrich Nietzsche

Related:

ALTER VIEW
DROP VIEW
Creating and Using Views (book-sample chapter)

Related Views:

 DBA_VIEWS            ALL_VIEWS            USER_VIEWS
 DBA_MVIEWS           ALL_MVIEWS           USER_MVIEWS

 V$FIXED_VIEW_DEFINITION 
 V$RESERVED_WORDS


© Copyright SS64.com 1999-2013
Some rights reserved