Purpose
This statement is used to drop a materialized view.
Privilege requirements
To drop a materialized view, you must have the DROP TABLE privilege. For more information about the privileges of OceanBase Database, see Privilege types in MySQL mode.
Syntax
DROP MATERIALIZED VIEW [IF EXISTS] materialized_view_list [opt_drop_behavior];
materialized_view_list:
[ database. ]materialized_view [,[ database. ]materialized_view]...
opt_drop_behavior:
RESTRICT | CASCADE
Parameters
| Parameter | Description |
|---|---|
| IF EXISTS | Optional. If you specify IF EXISTS, the system will not return an error even if the materialized view does not exist. If you do not specify this option, the system will return an error if the materialized view does not exist. |
| database. | Optional. Specifies the database where the materialized view is located. If you omit database., the system will default to your own database. |
| materialized_view | Specifies the name of the materialized view. |
| RESTRICT | CASCADE | Optional. Specifies the behavior of the drop operation.
|
Examples
Drop the materialized view named mv_test_tbl1 in the test_db database.
obclient [test_db]> DROP MATERIALIZED VIEW mv_test_tbl1;
The return result is as follows:
Query OK, 0 rows affected
