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: Joe Long <joe.long_at_cticallcenter.com>
Date: Thu, 28 Oct 1999 10:02:34 -0500
Message-ID: <3818658A.18EA8007@cticallcenter.com>


First find out what Oracle named the primary key constraint on the id column:

SELECT *
FROM dba_constraints
where table_name = 'HEADLINE';

Next run the following query substituting the primary key constraint name for
"CONSTRAINT NAME" SELECT *
FROM dba_constraints
WHERE r_constraint_name = 'CONSTRAINT_NAME'

This should tell you the foreign key constraint name the the table in which the foreign key column resides.

Finally do an ALTER TABLE and either drop or disable the foreign key constraint.

Hope it helps.

Joe Long

kev wrote:
>
> I forgot to mention that I have followed the 'Action' instructions from
> the 'oerr ora 02266' statement:
>
> *Action: Before performing the above operations the table, disable the
> // foreign key constraints in other tables. You can see what
> // constraints are referencing a table by issuing the following
> // command:
> // SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = "tabnam";
>
> but the above query returns an empty set of data.
>
> - Kev
>
> kev 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
> >
> > The table was created like this:
> >
> > create table headline
> > (
> > id number(10) primary key,
> > headline varchar2(200),
> > url varchar2(200),
> > grabtime number(15),
> > comments varchar2(200),
> > lang number(4),
> >
> > constraint fk_headline_lang
> > foreign key (lang)
> > references language (id)
> > );
> >
> > Is the constraint causing the problem? No row in the headline table has
> > any value in the lang column.
> >
> > thanks,
> >
> > - Kev
Received on Thu Oct 28 1999 - 10:02:34 CDT

Original text of this message

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