>
>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
>

 Gene,

   Your assumption is correct. Since TRUNCATE doesn't go through all rows (as DELETE) 
and cannot therefore check rows one by one, this is how it is implemented. BTW, do not 
be fooled by TRUNCATE even if its result is for the superficial mind the same as a DML 
command (DELETE): it is a DDL command. Therefore, Oracle checks exactly the same as 
with DROP.

Regards,

Stephane Faroult
Oriole
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroul
  INET: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).

Reply via email to