Creating and Using a View
A view is a predefined query on one or more tables. Querying a view is done in the same manner as retrieving from a table. Views don't store rows. Rows are always stored in tables. You can put a complex query into a view and grant users access to the view.
You create a view using CREATE VIEW
:
CREATE [OR REPLACE] VIEW
[{FORCE | NOFORCE}] VIEW view_name
[(alias_name[, alias_name ...])] AS subquery
[WITH {CHECK OPTION | READ ONLY} CONSTRAINT constraint_name];
Item | Description |
---|---|
OR REPLACE | the view replaces an existing view. |
FORCE | create the view even if the base tables don't exist. |
NOFORCE | don't create the view if the base tables don't exist. NOFORCE is the default. |
view_name | the name of the view. |
alias_name | the name of an alias for an expression in the subquery. |
subquery | is the subquery that retrieves from the base tables. |
WITH CHECK OPTION | means that only the rows that would be retrieved by the subquery can be inserted, updated, or deleted. By default, the rows are not checked. |
constraint_name | the name of the WITH CHECK OPTION or WITH READ ONLY constraint. |
WITH READ ONLY | means the rows may only read from the base tables. |
Privilege for Views
In order to create a view, the user must have the CREATE VIEW privilege.
GRANT CREATE VIEW TO store;
Home »
Oracle »
Table »
Oracle »
Table »
Views:
- Creating and Using a View
- Creating and Using Simple Views
- Performing an INSERT Using a View
- A View with a CHECK OPTION Constraint
- View with a READ ONLY Constraint
- Getting Information on View Definitions with DESCRIBE command
- Getting Information on View Definitions with user_views view
- Retrieving Information on View Constraints
- Creating and Using Complex Views
- Modifying a View
- Alter the constraints on a view using ALTER VIEW
- Dropping a View
Related: