Progress
SQL-89
Guide and Reference
CREATE VIEW Statement
Creates a view from one or more base tables, other views, or both.
view-name
The name of the view you want to create.
column [ , column ] ...
The names of the columns in the view. If you do not specify column names, Progress/SQL uses the column names in the SELECT statement. If the select list includes expressions or duplicate column names, you must specify column names for the view.
AS SELECT-statement
Defines how to derive the data for the view. The SELECT statement within a CREATE VIEW statement cannot contain an ORDER BY clause or a WITH clause. If you use the following syntax elements, you cannot update data in the view:
WITH CHECK OPTION
Ensures that all updates to the view satisfy the view-defining condition in the WHERE clause of the SELECT-statement. You cannot specify this option if the view is non-updatable.
EXAMPLEThis example creates a table view called doc from an employee in the Documentation department.
NOTES
- You can use the CREATE VIEW statement in interactive SQL or ESQL. However, the SQL Preprocessor does not recognize the CREATE VIEW statement.
- You must have the SELECT privilege on all tables and views to which the view that you are creating refers.
- You cannot use CREATE VIEW to create a view in an ORACLE database. However, you can create a view in the schema holder that refers to ORACLE objects.
- You cannot use a UNION statement within the CREATE VIEW statement. You can use only a simple SELECT statement.
- The following restrictions apply to updating tables through views:
- The view definition must not include the keyword DISTINCT, a GROUP BY clause, a HAVING clause, an expression, or an aggregate function.
- The FROM clause of the SELECT statement must specify only one table.
- The WHERE clause must not include a subquery.
- If the FROM clause refers to a view, the view must be updatable.
- Only an updatable view can include the keyword WITH CHECK OPTION in its definition.
SEE ALSO
CREATE SCHEMA Statement (ESQL Only), DROP VIEW Statement, GRANT Statement, REVOKE Statement
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |