Purpose
This statement is used to drop one or more views.
Limitations and considerations
When dropping multiple views, the current user must have the DROP privilege on each view.
Privilege requirements
To execute the DROP VIEW statement, the current user must have the DROP privilege. For more information about privileges in OceanBase Database, see Privilege classification in MySQL mode.
Syntax
DROP VIEW [IF EXISTS] view_name_list [CASCADE | RESTRICT];
view_name_list:
view_name [, view_name ...]
Parameters
| Parameter | Description |
|---|---|
| IF EXISTS | Optional. If specified, the view is dropped only if it 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:
NoticeIn the current version, only the syntax for specifying the drop option is supported. The option does not take effect. |
Examples
Drop the
v1view.DROP VIEW v1;Drop the
v2andv3views.DROP VIEW IF EXISTS v2, v3;Drop the
v2andv3views without using theIF EXISTSoption. If one of the views does not exist, an error is returned.DROP VIEW v1, v4;The return result is as follows:
ERROR 1051 (42S02): Unknown table 'test.v1'
