DROP TABLE
Purpose
This statement deletes a table.
Prerequisites
-
You need either the system privilege
USE ANY SCHEMAor the object privilegeUSAGEon the target schema, or the schema must be owned by you or one of your assigned roles. - You need the system privilege
DROP ANY TABLE, or the table must be owned by you or one of your assigned roles.
Syntax
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 EXISTSis specified, then the statement does not throw an exception if the table does not exist. - The options
RESTRICTorCASCADEare not of much significance in this command. However, they are supported syntactically for compatibility reasons. -
The
DROP TABLEcommand is rejected if there are foreign keys to the table and noCASCADE CONSTRAINTSclause is specified.
Example
DROP TABLE my_table;