Purpose
This statement is used to delete 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 OceanBase Database privileges, see Privilege classification in MySQL-compatible 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 this parameter is specified, it indicates that the drop operation will be performed if the view exists, and ignored if the view does not exist. |
| view_name_list | A list of column names of the view. You can delete one or more views. If view_name_list contains both existing and non-existing views, an error may occur, but the existing views will still be deleted. |
| view_name | The name of the view. |
| CASCADE | RESTRICT | Optional. Specifies the drop option. Valid values:
NoticeIn the current version, only the syntax of the drop option is supported, and the functionality is not effective. |
Examples
Drop the
v1view.DROP VIEW v1;Drop the
v2andv3views.DROP VIEW IF EXISTS v2, v3;Drop multiple 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'