DROP VIEW

2023-10-24 09:23:03  Updated

Purpose

You can use this statement to drop a view.

Note

The view must be in your own 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 own schema is dropped.
view_name The name of the view to be dropped.
CASCADE RESTRICT CASCADE indicates cascading drop. If CASCADE is specified, the objects dependent on this view are also dropped. RESTRICT indicates restricted drop. If RESTRICT is specified, a view with dependent objects cannot be dropped.
Note
This parameter is not supported in the current database version. If this parameter is provided, it will be parsed and ignored.

Examples

  • Drop the v1 view.

    obclient> DROP VIEW v1;
    Query OK, 0 rows affected
    
  • If you do not have the DROP ANY VIEW privilege, the system prompts that you are not authorized to drop the view.

    obclient> DROP VIEW user1.v2;
    ORA-01031: insufficient privileges
    

Contact Us