DROP TABLE

Drop a table.

Syntax:

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

Key
   schema   The name of the schema containing the table to be dropped
   table    The name of the table to drop
   PURGE    Bypass the RecycleBin

Examples

Drop a table, bypassing the recyclebin:

drop table SS64_table purge;

If the table does not exist, Oracle will return the error: ORA-00942 Table or View Does Not Exist

To drop a table and supress any ORA-00942 error:

BEGIN
EXECUTE IMMEDIATE 'DROP TABLE [schema.]table';
EXCEPTION WHEN OTHERS THEN NULL;
END;

"I've had a wonderful time, but this wasn't it” ~ Groucho Marx

Related Oracle Commands:

  ALTER TABLE DROP column
  ALTER TABLE DROP primary key/constraint
  DROP INDEX
  DROP SNAPSHOT
  DROP VIEW

Related Views:

  DBA_ALL_TABLES         ALL_ALL_TABLES         USER_ALL_TABLES
  DBA_TABLES             ALL_TABLES             USER_TABLES             TAB
  DBA_PARTIAL_DROP_TABS  ALL_PARTIAL_DROP_TABS  USER_PARTIAL_DROP_TABS 

 
Copyright © 1999-2024 SS64.com
Some rights reserved