DROP TABLE

Purpose

This statement deletes a table.

Prerequisite

You need to have the system privilege DROP ANY TABLE or the table belongs to the current user or one of the roles of the current user.

Syntax

drop_table::=

DROP TABLE

DROP TABLE

Usage Notes

  • If a table that you need to delete has foreign key references, then specify the option CASCADE CONSTRAINTS. When you specify this option, the foreign key references to the table are deleted even though the referencing table does not belong to the current user.
  • If the optional clause IF EXISTS is specified, then the statement does not throw an exception if the table does not exist.
  • The options RESTRICTor CASCADE are not of much significance in this command. However, they are supported syntactically for compatibility reasons.
  • The DROP TABLE command is rejected if there are foreign keys to the table and no CASCADE CONSTRAINTS clause is specified.

Example

DROP TABLE my_table;