DROP VIEW

2025-12-04 08:27:57  Updated

Description

You can execute the DROP VIEW statement to drop a view.

Limitations and considerations

When you drop a view, you must have the DROP privilege on the view.

Privilege requirements

To execute the DROP VIEW statement, you must have the DROP privilege. For more information about privileges in OceanBase Database, see Privilege types in Oracle mode.

Syntax

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

Parameter explanation

Parameter Description
schema. The schema where the view to be dropped is located. If you omit schema., the default schema is your current schema.
view_name The name of the view to be dropped.
CASCADE | RESTRICT CASCADE specifies to drop the view and all objects that depend on the view. RESTRICT specifies to drop the view only if no objects depend on it.
Notice At present, this parameter is not supported. If it is specified, 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, an error occurs indicating that you have insufficient privileges when you attempt to drop a view.

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

References

Contact Us