Integrity constraint error [message #168830] |
Sun, 23 April 2006 09:44 |
sharma.radha
Messages: 59 Registered: August 2005 Location: mumbai
|
Member |
|
|
Hi to everyone,
I am getting error while inserting a record. The message which i am getting by pressing 'Shift + F1' is written below.
This is a very common problem please someone provide me some
lines on this.
Quote: | SQL statement in error:
INSERT INTO
NOMINEE(PERSONALID,NAME_OF_NOMINEE,X,Y,Z)
VALUES(:1,:2,:3,:4,:5)
Error:
ORA-02291: integrity constraint (PAY.SYS_C003365) violated- parent key not found.
|
Waiting for reply.
Thanks
Radha.
|
|
|
Re: Integrity constraint error [message #168832 is a reply to message #168830] |
Sun, 23 April 2006 11:04 |
Frank Naude
Messages: 4590 Registered: April 1998
|
Senior Member |
|
|
It means that the insert will violate an enforced relationship between tables. You need to create a parent record before you can insert child records.
02291, 00000,"integrity constraint (%s.%s) violated - parent key not found"
// *Cause: A foreign key value has no matching primary key value.
// *Action: Delete the foreign key or add a matching primary key.
|
|
|
|
Re: Integrity constraint error [message #168884 is a reply to message #168859] |
Mon, 24 April 2006 00:59 |
Frank Naude
Messages: 4590 Registered: April 1998
|
Senior Member |
|
|
Not quite. Let's use the EMP and DEPT tables to illustrate the problem.
SQL> insert into emp values(1,'Frank','DBA',NULL,SYSDATE,100,NULL,99);
insert into emp values(1,'Frank','DBA',NULL,SYSDATE,100,NULL,99)
*
ERROR at line 1:
ORA-02291: integrity constraint (SCOTT.FK_DEPTNO) violated - parent key not
found
The problem is that there is no department 99 in the DEPT table. The solution is to use an existing department, or first insert a department 99 into DEPT:
SQL> insert into dept values (99,'DBA Team','Here');
1 row created.
SQL> insert into emp values(1,'Frank','DBA',NULL,SYSDATE,100,NULL,99);
1 row created.
|
|
|