Updated on 2024-06-03 GMT+08:00

DROP VIEW

Description

Deletes a view from a database.

Precautions

The owner of a view, owner of the schema of the view, users granted with the DROP permission on the view, or users granted with the DROP ANY TABLE permission can run the DROP VIEW command. By default, a system administrator has the permission to run the command when separation of duties is disabled.

Syntax

DROP VIEW [ IF EXISTS ] view_name [, ...] [ CASCADE | RESTRICT ];

Parameters

  • IF EXISTS

    Reports a notice instead of an error if the specified view does not exist.

  • view_name

    Specifies the name of the view to be deleted.

    Value range: an existing view name

  • CASCADE | RESTRICT
    • CASCADE: cascadingly deletes the objects (such as other views) that depend on the view.
    • RESTRICT: refuses to delete the view if any objects depend on it. This is the default action.

Examples

See Examples in section "CREATE VIEW."

Helpful Links

ALTER VIEW and CREATE VIEW