Re: We want to truncate a table in 11.2 which has a Primary Key

From: Steve Baldwin <stbaldwin_at_multiservice.com>
Date: Fri, 2 Dec 2011 07:07:12 +1100
Message-ID: <CAC-6Hs1SAFJsLUtHscKTHZEzKWMmjrTqmqXDuN6v3w49wPdDsQ_at_mail.gmail.com>



From the docs ...
Restrictions on Truncating Tables This statement is subject to the following restrictions:

   -

   You cannot individually truncate a table that is part of a cluster. You    must either truncate the cluster, delete all rows from the table, or drop    and re-create the table.
   -

   You cannot truncate the parent table of an enabled foreign key    constraint. You must disable the constraint before truncating the table. An    exception is that you can truncate the table if the integrity constraint is    self-referential.
   -

   If a domain index is defined on table, then neither the index nor any    index partitions can be marked IN_PROGRESS.    -

   You cannot truncate the parent table of a reference-partitioned table.    You must first drop the reference-partitioned child table.

On Fri, Dec 2, 2011 at 6:53 AM, Wolfson Larry - lwolfs < lawrence.wolfson_at_acxiom.com> wrote:

> One of the DBAs here wants to truncate a table in 11.2 which has a Primary
> Key which normally you'd get round with a cascade constraints
> The cascade constraint isn't part of the syntax but it used to either take
> it or ignore it. Not sure which.
> SYS.LARRY> truncate table XYZ cascade constraint drop storage;
> truncate table XYZ cascade constraint drop storage
> *
> ERROR at line 1:
> ORA-03291: Invalid truncate option - missing STORAGE keyword
>
> I've never seen Oracle complain about the missing storage keyword before,
> but maybe they tightened the syntax.
>
> SYS.LARRY> truncate table XYZ drop storage cascade constraint;
> truncate table XYZ drop storage cascade constraint
> * ERROR at line 1:
> ORA-03291: Invalid truncate option - missing STORAGE keyword
>
> SYS.LARRY> truncate table XYZ drop storage;
> truncate table XYZ drop storage
> *
> ERROR at line 1:
> ORA-02266: unique/primary keys in table referenced by enabled foreign keys
>
>
> Any Ideas?
>
> ***************************************************************************
> The information contained in this communication is confidential, is
> intended only for the use of the recipient named above, and may be legally
> privileged.
>
> If the reader of this message is not the intended recipient, you are
> hereby notified that any dissemination, distribution or copying of this
> communication is strictly prohibited.
>
> If you have received this communication in error, please resend this
> communication to the sender and delete the original message or any copy
> of it from your computer system.
>
> Thank You.
>
> ****************************************************************************
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>



This email is intended solely for the use of the addressee and may contain information that is confidential, proprietary, or both. If you receive this email in error please immediately notify the sender and delete the email.
--
http://www.freelists.org/webpage/oracle-l
Received on Thu Dec 01 2011 - 14:07:12 CST

Original text of this message