DROP VIEW statement
Use the DROP VIEW statement to remove a view from the database.
This statement is an extension to the ANSI/ISO standard for SQL.
Syntax
Element | Description | Restrictions | Syntax |
---|---|---|---|
owner | Name of view owner | Must own the view | Owner name |
synonym | Synonym for a view that this statement drops | The synonym and the view to which it points must exist in the local database | Identifier |
view | Name of a view to drop | Must exist in systables | Identifier |
Usage
To drop a view, you must be the owner or have the DBA privilege.
When you drop a view, you also drop any other views and INSTEAD OF triggers whose definitions depend on that view. (You can also specify this default behavior explicitly with the CASCADE keyword.)
If you include the optional IF EXISTS keywords, the database server takes no action (rather than sending an exception to the application) if no view of the specified name is registered in the current database.
When you include the RESTRICT keyword in the DROP VIEW statement, the drop operation fails if any other existing views are defined on view; otherwise, these dependent views would be unregistered by the DROP VIEW operation.
You can query the sysdepend system catalog table to determine which views, if any, depend on another view.
DROP VIEW cust1