Oracle “DROP TABLE”


DROP  TABLE

Use the DROP TABLE statement to move a table or object table to the recycle bin or to remove the table and all its data from the database entirely.

Dropping a table invalidates dependent objects and removes object privileges on the table. Thus if you just want to claim the space, have a look at ” TRUNCATE TABLE”.

SYNTAX

DROP TABLE [ schema. ] table  [ CASCADE CONSTRAINTS ] [ PURGE ] ;

PURGE

Specify PURGE if you want to drop the table and release the space associated with it in a single step. If you specify PURGE, then the database does not place the table and its dependent objects into the recycle bin.

Using this clause is equivalent to first dropping the table and then purging it from the recycle bin.

Recycle Bin

Shit !!! I dropped “Users” table. What can ı do now ? Hint: “FLASHBACK TABLE”; but that’s for another post.

CASCADE CONSTRAINTS

Specify CASCADE CONSTRAINTS to drop all referential integrity constraints (foreign keys) that refer to primary and unique keys in the dropped table. If you omit this clause, and such referential integrity constraints exist, then the database returns an error and does not drop the table.