CREATE VIEW statement
482
CREATE VIEW statement
Use this statement to create a view on the database. Views are used to give a
different perspective on the data, even though it is not stored that way.
CREATE VIEW
… [
owner
.]
view-name
[(
column-name
, … )]
… AS
select-without
-
order-by
… [ WITH CHECK OPTION ]
Must have RESOURCE authority and SELECT permission on the tables in
the view definition.
Automatic commit.
"DROP statement" on page 505
"CREATE TABLE statement" on page 466
The CREATE VIEW statement creates a view with the given name. You can
create a view owned by another user by specifying the owner. You must
have DBA authority to create a view for another user.
A view name can be used in place of a table name in SELECT, DELETE,
UPDATE, and INSERT statements. Views, however, do not physically exist
in the database as tables. They are derived each time they are used. The view
is derived as the result of the SELECT statement specified in the
CREATE VIEW statement. Table names used in a view should be qualified
by the user ID of the table owner. Otherwise, a different user ID might not be
able to find the table or might get the wrong table.
Views can be updated unless the SELECT statement defining the view
contains a GROUP BY clause, an aggregate function, or involves a UNION
operation. An update to the view causes the underlying table(s) to be
updated.
view-name The view-name is an identifier. The default owner is the
current user ID.
column-name The columns in the view are given the names specified in
the column-name list. If the column name list is not specified, the view
columns are given names from the select list items. In order to use the names
from the select list items, each item must be a simple column name or have
an alias-name specified (see "SELECT statement" on page 601).
AS clause The SELECT statement on which the view is based must not
have an ORDER BY clause on it. It may have a GROUP BY clause and may
be a UNION. The SELECT statement must not refer to local temporary
tables.
Function
Syntax
Permissions
Side effects
See also
Description
Parameters