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

Home -> Community -> Usenet -> c.d.o.server -> Re: truncate problem

Re: truncate problem

From: Kevin Fries <kelfink_at_ecst.csuchico.edu>
Date: 1999/11/04
Message-ID: <7vsqgj$7ub$1@hubble.csuchico.edu>#1/1

In article <3816E479.D88E3A79_at_fast.no>, kev <kevin.porter_at_fast.no> wrote:
>I've just tried to do a truncate on a table, but get this error:
>
>ORA-02266: unique/primary keys in table referenced by enabled foreign
>keys
>
>- Kev
>

Kev,

The real problem here is the error message. It's wrong. In Oralce 8i (and possibly earlier) Oralce finally fixed it to be :

ORA-02449: unique/primary keys in table referenced by foreign keys

Does it look more obvious now? You might have already disabled all the constraints there are. Not good enough. You must drop them.

You'll need to save their definitions (oracle doesn't provide for this) by querying user_constraints, and user_cons_columns (or the "all" views if others have access to your schema) and create ALTER TABLE ... DROP CONSTRAINT" statements.

Remember to save those definitions because they'll be gone from Oracle.

Kind of a half-assed implementation, if you ask me. Still, it's better than not having it. Just keep the original definition of your table handy.

hth
Kevin Fries

-- 
-------------------------------------------------------------
Kevin Fries                         kelfink_at_ecst.csuchico.edu
CPD/PB, C Developer/DBA  http://www.ecst.csuchico.edu/~kelfink
Received on Thu Nov 04 1999 - 00:00:00 CST

Original text of this message

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