The DROP statement deletes a table or index.
Invocation
This statement can be used in an application program using the DB2 CLI functions
or issued through the CLP.
Syntax
>>-DROP--+-TABLE--table-name-+---------------------------------><
'-INDEX--index-name-'
Description
- TABLE table-name
- Identifies the base table that is to be dropped. table-name must
identify a table that is described in the catalog (SQLSTATE 42704).
- INDEX index-name
- Identifies the index that is to be dropped. The index-name must
identify an index that is described in the catalog (SQLSTATE 42704). It cannot
be an index required by the system for a primary key (SQLSTATE 42704).
Rules
None.
Notes
- Tables and indexes should not be dropped when a table is in use (a statement
handle is active on a query which uses that table or index). Dropping tables
and indexes that are in use will invalidate statement handles which involve
the table or index.
Example
Drop table EMPLOYEE.
DROP TABLE EMPLOYEE
Related reference