Purpose
This statement is used to drop a materialized view.
Privilege requirements
You must have the DROP TABLE privilege to delete a materialized view log. For more information about OceanBase AI Database privileges, see Permission classification.
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
Parameters |
Description |
|---|---|
| IF EXISTS | Optional. If IF EXISTS is specified, no error is returned even if the materialized view to be dropped does not exist; if it is not specified, an error is returned when the materialized view to be dropped does not exist. |
| database. | Optional. Specifies the database where the materialized view is located. If omitted, the current database is used. database., it is stored in your own database by default. |
| materialized_view | Specifies the name of the materialized view. |
| RESTRICT \ | CASCADE | Optional. Specifies the behavior of the DELETE operation.
|
Examples
Drop the materialized view named mv_test_tbl1 from the test_db database.
obclient [test_db]> DROP MATERIALIZED VIEW mv_test_tbl1;
The return result is as follows:
Query OK, 0 rows affected