Purpose
This statement is used to delete one or more views.
Limitations and considerations
When deleting 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 operation will be executed if the view exists, and ignored if it does not. |
| view_name_list | A list of view column names to be deleted. 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 deletion option. Valid values:
NoticeIn the current version, only the syntax for deletion options is supported, and the functionality is not effective. |
Examples
Delete the view
v1.DROP VIEW v1;Delete the views
v2andv3.DROP VIEW IF EXISTS v2, v3;Delete multiple views without using
IF EXISTS. If any view does not exist, an error will be returned.DROP VIEW v1, v4;The return result is as follows:
ERROR 1051 (42S02): Unknown table 'test.v1'