DROP TABLE
Purpose
This statement deletes a table.
Prerequisites
-
You need either the system privilege
USE ANY SCHEMA
or the object privilegeUSAGE
on 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 EXISTS
is specified, then the statement does not throw an exception if the table does not exist. - The options
RESTRICT
orCASCADE
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 noCASCADE CONSTRAINTS
clause is specified.