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 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 AI Database privileges, see Permission classification.
Syntax
DROP VIEW [IF EXISTS] view_name_list [CASCADE | RESTRICT];
view_name_list:
view_name [, view_name ...]
Parameters
Parameters |
Description |
|---|---|
| IF EXISTS | Optional. If this parameter is specified, the delete operation will be executed if the view exists; otherwise, it will be ignored. |
| view_name_list | Specify the list of column names for the views to drop. You can drop one or more views. If view_name_list contains some views that exist and some that do not. An error may be returned during execution, but the existing views will still be deleted. |
| view_name | The name of the view. |
| CASCADE \ | RESTRICT | Optional. Specifies the deletion options, as described below:
NoteThe current version only supports the syntax for this option; the feature is not available. |
Examples
Drop the single view
v1.DROP VIEW v1;Drop the two views
v2andv3.DROP VIEW IF EXISTS v2, v3;Do not use
IF EXISTS. When deleting multiple views, if any one 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'