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: parent keys not found?

Re: parent keys not found?

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Thu, 2 Dec 1999 11:32:01 +0100
Message-ID: <825hoa$7k9r$1@oceanite.cybercable.fr>


This message does not mean that the primary key of the referenced table does not exist but that some rows in the table plati have a pid that is not in the pid column of the prima table. You can check that with the query:
select * from plati
where not exists (select null from prima

                  where prima.pid = plati.pid);

--
Have a nice day
Michel

Stefanita Vilcu <vsv_at_dnt.ro> a écrit dans le message : 384645F8.301FEE04_at_dnt.ro...
> hello,
>
> I am trying to add a foreign key to a table but I receive:
>
> SQL> ALTER TABLE PLATI ADD CONSTRAINT fk_PLATI_pid FOREIGN KEY (pid)
> REFERENCES PRIMA (pid);
> ALTER TABLE PLATI ADD CONSTRAINT fk_PLATI_pid FOREIGN KEY (pid)
> REFERENCES PRIMA (pid)
> *
> ERROR at line 1:
> ORA-02298: cannot enable (DNTB.FK_PLATI_PID) - parent keys not found
>
> The parent key exists and is enabled. Is there anything elese I should
> do?
>
> TIA
>
> -vsv
>
>
> SQL> select * from all_constraints where
> constraint_name='PK_PRIMA_PID';
>
> OWNER CONSTRAINT_NAME C
> TABLE_NAME
> SEARCH_CONDITION
> R_OWNER R_CONSTRAINT_NAME DELETE_RU
> STATUS DEFERRABLE DEFERRED VALIDATED GENERATED BAD
> LAST_CHAN
> ------------------------------ ------------------------------ -
> ------------------------------
> ------------------------------------------------------------------------------
--
> ------------------------------ ------------------------------ ---------
> -------- -------------- --------- ------------- -------------- ---
> ---------
> DNTB PK_PRIMA_PID P
> PRIMA
> ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED USER NAME
> 02-DEC-99
Received on Thu Dec 02 1999 - 04:32:01 CST

Original text of this message

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