Home » SQL & PL/SQL » SQL & PL/SQL » ORA-02298 cannot validate - Parent keys not found (Oracle 10g, win xp)
icon4.gif  ORA-02298 cannot validate - Parent keys not found [message #546380] Tue, 06 March 2012 07:12 Go to next message
stalin4d
Messages: 226
Registered: May 2010
Location: Chennai, Tamil Nadu, Indi...
Senior Member
Hi,

I have an issue, actually i need to delete a record from table
but it showed a error for foreign key constraint so i disabled the constraint and again deleted, now the row is deleted.

Again inserted another values instead the deleted value.

after that i tried to alter the constraint
but i received the
error ORA-02298 cannot validate - Parent keys not found

alter table t1  enable constraint FK_T1;


But i am not able to enable the key. what to do?

pls help...

Re: ORA-02298 cannot validate - Parent keys not found [message #546381 is a reply to message #546380] Tue, 06 March 2012 07:14 Go to previous messageGo to next message
muralikri
Messages: 638
Registered: August 2011
Location: chennai
Senior Member

Check the master table and child having matched records or not?
Re: ORA-02298 cannot validate - Parent keys not found [message #546383 is a reply to message #546381] Tue, 06 March 2012 07:19 Go to previous messageGo to next message
muralikri
Messages: 638
Registered: August 2011
Location: chennai
Senior Member

Master table...
 ALTER TABLE emp1 ADD CONSTRAINT fk_orders1 FOREIGN KEY (deptno) REFERENCES dept(deptno);
select deptno from dept 
    DEPTNO
----------
        10
        20
        30
        40
Insert into EMP1  (EMPNO, ENAME, JOB, MGR, SAL, DEPTNO, HIREDATE, COMM)
 Values  (123, 'SMITH', 'CLERK', 7902, 153, 50, TO_DATE('06/23/2011 16:21:41', 'MM/DD/YYYY HH24:MI:SS'), 8);
ORA-02291: integrity constraint (ACXIOM_RD.FK_ORDERS1) violated - parent key not found

 


Re: ORA-02298 cannot validate - Parent keys not found [message #546384 is a reply to message #546383] Tue, 06 March 2012 07:20 Go to previous messageGo to next message
muralikri
Messages: 638
Registered: August 2011
Location: chennai
Senior Member

Deptno=50 not exits master table-DEPT
Re: ORA-02298 cannot validate - Parent keys not found [message #546393 is a reply to message #546384] Tue, 06 March 2012 08:32 Go to previous messageGo to next message
stalin4d
Messages: 226
Registered: May 2010
Location: Chennai, Tamil Nadu, Indi...
Senior Member
yes updated into child as it is in parent key.
Re: ORA-02298 cannot validate - Parent keys not found [message #546395 is a reply to message #546393] Tue, 06 March 2012 08:40 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
stalin4d wrote on Tue, 06 March 2012 09:32
yes updated into child as it is in parent key.


I for one have no idea what you did to what tables based on your circuitous explanation, but I am betting that Oracle is correct in it's error messages.
Re: ORA-02298 cannot validate - Parent keys not found [message #546397 is a reply to message #546395] Tue, 06 March 2012 08:48 Go to previous message
cookiemonster
Messages: 13966
Registered: September 2008
Location: Rainy Manchester
Senior Member
And since integrity constraints exist for a reason, if you have to disable one then you are almost certainly doing something wrong.

I'm betting you deleted a parent row without deleting the child rows first.
You should have deleted the child rows, then the parent, and not touched the foreign key.
Now you'll need to find the ophaned child rows and delete them and hope nothing else has mangled the rest of the data in the mean time.
Previous Topic: Calling a REF from a Insert Member Procedure
Next Topic: ORA-00932: inconsistent datatypes: expected - got -
Goto Forum:
  


Current Time: Thu May 01 12:14:24 CDT 2025