Background documentationDROP TABLE Statement (drop_table_statement) Locate this document in the navigation structure

 

A DROP TABLE statement (drop_table_statement) deletes a base table.

Structure

Syntax Syntax

  1. <drop_table_statement> ::=
      DROP TABLE <table_name> [<cascade_option>]
End of the code.
Examples

SQL Tutorial, Tables

Explanation

If a schema name is not specified in the table name, the current schema is used. The table name must be the name of an existing base table. The current database user must be the owner of the base table or have the DROPIN privilege for the schema to which the table to be dropped belongs.

All of the metadata and rows in the base table are dropped, along with the view tables, indexes, privileges, synonyms, and referential CONSTRAINT definitions derived from the base table.

If all of the data that is linked to this base table by means of a referential CONSTRAINT definition with a DELETE rule is processed according to the specified DELETE rule, a DELETE statement must first be executed for this base table, followed by the DROP TABLE statement.

<cascade_option>

If no CASCADE option is specified, the DROP TABLE statement is executed independently of the dependencies.

  • RESTRICT: The DROP TABLE statement fails if view tables or synonyms are based on the specified table.

  • CASCADE: The DROP TABLE statement is executed independently of the dependencies.

More Information

Privileges: Overview