Home » Developer & Programmer » Forms » Integrity constraint error
Integrity constraint error [message #168830] Sun, 23 April 2006 09:44 Go to next message
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 Go to previous messageGo to next message
Frank Naude
Messages: 4580
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 #168859 is a reply to message #168832] Sun, 23 April 2006 19:59 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Make sure that you only 'insert' new records and not one that already exists. In which trigger do you have this code?

David
Re: Integrity constraint error [message #168884 is a reply to message #168859] Mon, 24 April 2006 00:59 Go to previous message
Frank Naude
Messages: 4580
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.


Previous Topic: How to enable a field by clicking on a check box..........
Next Topic: export not working with template.fmb
Goto Forum:
  


Current Time: Fri Sep 20 09:23:42 CDT 2024