DROP VIEW
Description
This statement is used to drop one or more views.
Limitations and Considerations
When dropping multiple views, the current user must have the DROP permission on each view.
Permissions
To execute the DROP VIEW statement, the current user must have the DROP permission. For more information about seekdb permissions, see seekdb permission types.
Syntax
DROP VIEW [IF EXISTS] view_name_list [CASCADE | RESTRICT];
view_name_list:
view_name [, view_name ...]
Parameters
| Parameter | Description |
|---|---|
| IF EXISTS | Optional. If this parameter is specified, the drop operation is performed only if the view exists. If the view does not exist, the operation is ignored. |
| view_name_list | The list of view names to be dropped. You can drop one or more views. If view_name_list contains both existing and non-existing views, an error may be returned, but the existing views will still be dropped. |
| view_name | The name of the view. |
| CASCADE | RESTRICT | Optional. Specifies the drop option. Valid values:
|
Examples
-
Drop the view
v1.DROP VIEW v1; -
Drop the views
v2andv3.DROP VIEW IF EXISTS v2, v3; -
Drop the views without using
IF EXISTS. If any of the views do not exist, an error will be returned.DROP VIEW v1, v4;The return result is as follows:
ERROR 1051 (42S02): Unknown table 'test.v1'