Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Truncate Qs
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01BFDB98.0C0892D0
Content-Type: text/plain;
charset="iso-8859-1"
Cascade constraints option does not exist in truncate.
Alex Hillman
-----Original Message-----
From: Scott Shafer [mailto:scott.shafer_at_ildmail.com]
Sent: Tuesday, June 20, 2000 5:58 PM
To: Multiple recipients of list ORACLE-L
Subject: Re: Truncate Qs
because constraints exist independent of data. If there are any foreign key relationships, you need to use "cascade constraints" which tells the db to ignore any key info...
--Scott
> Thanks Scott,
> I was just wondering if there is no data in the table, then also why
should
> truncate table give the error.
>
> To: <willsm_at_hotmail.com>
> Date: Tue, 20 Jun 2000 14:40:33 -0500
>
> truncate table <tabname> cascade constraints;
>
> ----- Original Message -----
> To: "Multiple recipients of list ORACLE-L" <ORACLE-L_at_fatcity.com>
> Sent: Tuesday, June 20, 2000 3:12 PM
>
>
> > Hello,
> > Can someone please explain me this:
> > I tried to truncate a table, it gave ORA-2266.
> > But when I deleted the rows, it did not show the error. And after
> deleting
> > the rown I tried to truncate the table again, but it still gives
ORA-2266
> >
> > TIA
> > Prabal
> >
> > SQL> truncate table supplier_order;
> > truncate table supplier_order
> > *
> > ERROR at line 1:
> > ORA-02266: unique/primary keys in table referenced by enabled foreign
> keys
> >
> > SQL> delete supplier_order;
> >
> > 97 rows deleted.
> >
> > SQL> truncate table supplier_order;
> > truncate table supplier_order
> > *
> > ERROR at line 1:
> > ORA-02266: unique/primary keys in table referenced by enabled foreign
> keys
> >
> >
-- Author: Scott Shafer INET: scott.shafer_at_ildmail.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). ------_=_NextPart_001_01BFDB98.0C0892D0 Content-Type: text/html; charset="iso-8859-1" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2448.0"> <TITLE>RE: Truncate Qs</TITLE> </HEAD> <BODY> <P><FONT SIZE=2>Cascade constraints option does not exist in truncate.</FONT> </P> <P><FONT SIZE=2>Alex Hillman</FONT> </P> <P><FONT SIZE=2>-----Original Message-----</FONT> <BR><FONT SIZE=2>From: Scott Shafer [<A HREF="mailto:scott.shafer_at_ildmail.com">mailto:scott.shafer_at_ildmail.com</A>]</FONT> <BR><FONT SIZE=2>Sent: Tuesday, June 20, 2000 5:58 PM</FONT> <BR><FONT SIZE=2>To: Multiple recipients of list ORACLE-L</FONT> <BR><FONT SIZE=2>Subject: Re: Truncate Qs</FONT> </P> <BR> <P><FONT SIZE=2>because constraints exist independent of data. If there are any foreign key</FONT> <BR><FONT SIZE=2>relationships, you need to use "cascade constraints" which tells the db to</FONT> <BR><FONT SIZE=2>ignore any key info...</FONT> </P> <P><FONT SIZE=2>--Scott</FONT> </P> <P><FONT SIZE=2>----- Original Message -----</FONT> <BR><FONT SIZE=2>To: "Multiple recipients of list ORACLE-L" <ORACLE-L_at_fatcity.com></FONT> <BR><FONT SIZE=2>Sent: Tuesday, June 20, 2000 4:19 PM</FONT> </P> <BR> <P><FONT SIZE=2>> Thanks Scott,</FONT> <BR><FONT SIZE=2>> I was just wondering if there is no data in the table, then also why</FONT> <BR><FONT SIZE=2>should</FONT> <BR><FONT SIZE=2>> truncate table give the error.</FONT> <BR><FONT SIZE=2>></FONT> <BR><FONT SIZE=2>> To: <willsm_at_hotmail.com></FONT> <BR><FONT SIZE=2>> Date: Tue, 20 Jun 2000 14:40:33 -0500</FONT> <BR><FONT SIZE=2>></FONT> <BR><FONT SIZE=2>> truncate table <tabname> cascade constraints;</FONT> <BR><FONT SIZE=2>></FONT> <BR><FONT SIZE=2>> ----- Original Message -----</FONT> <BR><FONT SIZE=2>> To: "Multiple recipients of list ORACLE-L" <ORACLE-L_at_fatcity.com></FONT> <BR><FONT SIZE=2>> Sent: Tuesday, June 20, 2000 3:12 PM</FONT> <BR><FONT SIZE=2>></FONT> <BR><FONT SIZE=2>></FONT> <BR><FONT SIZE=2>> > Hello,</FONT> <BR><FONT SIZE=2>> > Can someone please explain me this:</FONT> <BR><FONT SIZE=2>> > I tried to truncate a table, it gave ORA-2266.</FONT> <BR><FONT SIZE=2>> > But when I deleted the rows, it did not show the error. And after</FONT> <BR><FONT SIZE=2>> deleting</FONT> <BR><FONT SIZE=2>> > the rown I tried to truncate the table again, but it still gives</FONT> <BR><FONT SIZE=2>ORA-2266</FONT> <BR><FONT SIZE=2>> ></FONT> <BR><FONT SIZE=2>> > TIA</FONT> <BR><FONT SIZE=2>> > Prabal</FONT> <BR><FONT SIZE=2>> ></FONT> <BR><FONT SIZE=2>> > SQL> truncate table supplier_order;</FONT> <BR><FONT SIZE=2>> > truncate table supplier_order</FONT> <BR><FONT SIZE=2>> > *</FONT> <BR><FONT SIZE=2>> > ERROR at line 1:</FONT> <BR><FONT SIZE=2>> > ORA-02266: unique/primary keys in table referenced by enabled foreign</FONT> <BR><FONT SIZE=2>> keys</FONT> <BR><FONT SIZE=2>> ></FONT> <BR><FONT SIZE=2>> > SQL> delete supplier_order;</FONT> <BR><FONT SIZE=2>> ></FONT> <BR><FONT SIZE=2>> > 97 rows deleted.</FONT> <BR><FONT SIZE=2>> ></FONT> <BR><FONT SIZE=2>> > SQL> truncate table supplier_order;</FONT> <BR><FONT SIZE=2>> > truncate table supplier_order</FONT> <BR><FONT SIZE=2>> > *</FONT> <BR><FONT SIZE=2>> > ERROR at line 1:</FONT> <BR><FONT SIZE=2>> > ORA-02266: unique/primary keys in table referenced by enabled foreign</FONT> <BR><FONT SIZE=2>> keys</FONT> <BR><FONT SIZE=2>> ></FONT> <BR><FONT SIZE=2>> ></FONT> <BR><FONT SIZE=2>________________________________________________________________________</FONT> <BR><FONT SIZE=2>> > Get Your Private, Free E-mail from MSN Hotmail at</FONT> <BR><FONT SIZE=2>http://www.hotmail.com</FONT> <BR><FONT SIZE=2>> ></FONT> <BR><FONT SIZE=2>> > --</FONT> <BR><FONT SIZE=2>> > Author: Prabal Biswas</FONT> <BR><FONT SIZE=2>> > INET: willsm_at_hotmail.com</FONT> <BR><FONT SIZE=2>> ></FONT> <BR><FONT SIZE=2>> > Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051</FONT> <BR><FONT SIZE=2>> > San Diego, California -- Public Internet access / Mailing Lists</FONT> <BR><FONT SIZE=2>> > --------------------------------------------------------------------</FONT> <BR><FONT SIZE=2>> > To REMOVE yourself from this mailing list, send an E-Mail message</FONT> <BR><FONT SIZE=2>> > to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in</FONT> <BR><FONT SIZE=2>> > the message BODY, include a line containing: UNSUB ORACLE-L</FONT> <BR><FONT SIZE=2>> > (or the name of mailing list you want to be removed from). You may</FONT> <BR><FONT SIZE=2>> > also send the HELP command for other information (like subscribing).</FONT> <BR><FONT SIZE=2>></FONT> <BR><FONT SIZE=2>></FONT> <BR><FONT SIZE=2>> ________________________________________________________________________</FONT> <BR><FONT SIZE=2>> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com</FONT> <BR><FONT SIZE=2>></FONT> <BR><FONT SIZE=2>> --</FONT> <BR><FONT SIZE=2>> Author: Prabal Biswas</FONT> <BR><FONT SIZE=2>> INET: willsm_at_hotmail.com</FONT> <BR><FONT SIZE=2>></FONT> <BR><FONT SIZE=2>> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051</FONT> <BR><FONT SIZE=2>> San Diego, California -- Public Internet access / Mailing Lists</FONT> <BR><FONT SIZE=2>> --------------------------------------------------------------------</FONT> <BR><FONT SIZE=2>> To REMOVE yourself from this mailing list, send an E-Mail message</FONT> <BR><FONT SIZE=2>> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in</FONT> <BR><FONT SIZE=2>> the message BODY, include a line containing: UNSUB ORACLE-L</FONT> <BR><FONT SIZE=2>> (or the name of mailing list you want to be removed from). You may</FONT> <BR><FONT SIZE=2>> also send the HELP command for other information (like subscribing).</FONT> </P> <P><FONT SIZE=2>-- </FONT> <BR><FONT SIZE=2>Author: Scott Shafer</FONT> <BR><FONT SIZE=2> INET: scott.shafer_at_ildmail.com</FONT> </P> <P><FONT SIZE=2>Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051</FONT> <BR><FONT SIZE=2>San Diego, California -- Public Internet access / Mailing Lists</FONT> <BR><FONT SIZE=2>--------------------------------------------------------------------</FONT> <BR><FONT SIZE=2>To REMOVE yourself from this mailing list, send an E-Mail message</FONT> <BR><FONT SIZE=2>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in</FONT> <BR><FONT SIZE=2>the message BODY, include a line containing: UNSUB ORACLE-L</FONT> <BR><FONT SIZE=2>(or the name of mailing list you want to be removed from). You may</FONT>Received on Wed Jun 21 2000 - 10:47:47 CDT