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

Home -> Community -> Mailing Lists -> Oracle-L -> Re:a simple question about FKs

Re:a simple question about FKs

From: <dgoulet_at_vicr.com>
Date: Tue, 18 Jun 2002 06:03:33 -0800
Message-ID: <F001.004803B5.20020618060333@fatcity.com>


Gene,

    In the event of a delete from the parent Oracle has a chance to check the child table(s) to see if the parent is still valid. But since a truncate is really a DDL, not DML, command there is no such chance. Therefore if you want to truncate a table you have to disable the foreign keys. Same thing as dropping a table, except that Oracle provided the 'cascade constraints' qualifier.

Dick Goulet

____________________Reply Separator____________________
Author: Gurelei <gurelei_at_yahoo.com>
Date:       6/18/2002 5:43 AM

Hi.

I was trying to truncate a table, which is a parent to two other tables (its PK is referred to by two FKs from two other tables). These "other" tables are empty.
When I tried to truncate the parent table, however, I got an error message ORA-02266: unique/primary keys in table referenced by enabled foreign keys. I thought that as long as the child tables are empty, the RI shouldn't matter, but I had to disable the FKs before being able to truncate the table. Is that the way Oracle checks truncates (no enabled RIs even if the tables are empty) or did I do something incorrectly?

thanks

Gene



Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Gurelei
  INET: gurelei_at_yahoo.com
Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author:
  INET: dgoulet_at_vicr.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Jun 18 2002 - 09:03:33 CDT

Original text of this message

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