Drop a view

2023-07-24 09:52:12  Updated

You can use the DROP VIEW statement to drop a view. This topic describes how to drop a view.

Prerequisites

The view must be in your schema, or you must have the DROP ANY VIEW privilege if you want to drop the view in another user's schema.

Syntax

DROP VIEW [schema.] view_name [CASCADE | RESTRICT];

Parameters

Parameter Description
schema. The schema where the view to be dropped is located. If schema. is omitted, the view in your schema is dropped.
view_name The name of the view to be dropped.
CASCADE RESTRICT CASCADE indicates that the objects dependent on the view are automatically removed. RESTRICT indicates that the view cannot be dropped if an object that depends on the view exists.

Note
The current version does not support this parameter. If this parameter is specified, it will be parsed and ignored.

Examples

Drop the v1 view.

obclient> DROP VIEW v1;
Query OK, 0 rows affected

Contact Us