Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Drop Table with Foreign Constraints & Indexes

Re: Drop Table with Foreign Constraints & Indexes

From: Hans Forbrich <news.hans_at_telus.net>
Date: Sun, 26 Sep 2004 00:48:30 GMT
Message-ID: <ylo5d.155910$XP3.51682@edtnps84>


Ste wrote:

> Hi,
>
> I would like to seek help dropping a table with foreign keys being
> referenced to and referencing other table. Do we disable constraints
> first before "drop table constraints cascade"? Would dropping this
> table drop other foreign key referenced table too?
>
> Thanks for any comments.
>
> Ste

Two suggestions:

  1. Check the documentation (http://docs.oracle.com), in the SQL Reference manual under DROP TABLE;
  2. Try a simple test - this should take about 6 lines.

Hint: according to the docco "Specify CASCADE CONSTRAINTS to drop all referential integrity constraints that refer to primary and unique keys in the dropped table. If you omit this clause, and such referential integrity constraints exist, then Oracle returns an error and does not drop the table."

In other wrds, if you don't want to implicitly drop children tables, don't include CASCADE CONSTRAINTS ... OR drop the associated constraint.

/Hans Received on Sat Sep 25 2004 - 19:48:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US