Hitachi

Hitachi Advanced Database SQL Reference


3.15.1 Specification format and rules for the DROP VIEW statement

The DROP VIEW statement deletes a viewed table.

Organization of this subsection

(1) Specification format

DROP-VIEW-statement ::= DROP VIEW table-name [drop-behavior]
 
  drop-behavior ::= {CASCADE | RESTRICT}

(2) Explanation of specification format

[Figure] table-name

Specifies the name of the viewed table to be deleted. For rules on specifying a table name, see (2) Table name specification format in 6.1.5 Qualifying a name.

You cannot specify the table names of the following tables:

  • Base tables

  • Dictionary tables

  • System tables

drop-behavior
drop-behavior ::= {CASCADE | RESTRICT}

Specifies whether to delete the viewed tables if the following condition is met:

  • Viewed tables that depend on the viewed table to be deleted exist.

The following table describes the possible specifications for drop-behavior.

Specification of drop-behavior

Description

Handling of viewed tables that depend on the viewed table to be deleted

If drop-behavior is omitted

The viewed tables are also deleted if the following condition is met:

  • Viewed tables that depend on the viewed table to be deleted exist.

The viewed tables that depend on the viewed table to be deleted are invalidated. The viewed table in the relevant schema and the viewed tables in other schemata are invalidated.

If CASCADE is specified

The viewed tables that depend on the viewed table to be deleted are deleted. The viewed table in the relevant schema and the viewed tables in other schemata are deleted.

If RESTRICT is specified

The DROP VIEW statement results in an error if the following condition is met:

  • Viewed tables that depend on the viewed table to be deleted exist.

The dependent viewed tables are not affected because the DROP VIEW statement results in an error.

(3) Privileges required at execution

To execute the DROP VIEW statement, the CONNECT privilege and schema definition privilege are required.

(4) Rules

  1. You cannot delete a viewed table that has a schema name different from the authorization identifier connected to the HADB server.

  2. If you delete a viewed table, all HADB users who have the access privileges for that viewed table will have the access privileges revoked.

(5) Example

Example

Delete the viewed table of shops (VSHOPSLIST).

DROP VIEW "VSHOPSLIST" CASCADE