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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Truncate fail, delete OK...

Re: Truncate fail, delete OK...

From: <aneela1975_at_my-deja.com>
Date: Tue, 02 Nov 1999 19:46:26 GMT
Message-ID: <7vnf2h$dnp$1@nnrp1.deja.com>


In article <7vn90g$90i$1_at_nnrp1.deja.com>,   alan_psb_at_yahoo.com wrote:
>
>
> Table Children has foreign key referenced to Table Mother.
>
> Now, truncate table Children and no problem.
>
> Next, truncate table Mother and failed. The error message indicate the
> foreign key constraint violated. (Mother has only one table Children
> referenced to her)
>
> Later, delete from table Mother and it is OK.
>
> Why I cannot truncate table Mother when the table Children has no
> record? What should I do such that I can use truncate statement on
table
> Mother (except drop table Children, disable constraint)
>
> Thanks,
> Alan
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

TRUNCATE is a DDL command. So oracle will not allow you perform a DDL on table if it has dependents. DELETE is not a DDL, so this is ok. To truncate a parent table you need to first disable all the constraints and then perform a truncate

Regards
Anil

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Nov 02 1999 - 13:46:26 CST

Original text of this message

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