Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Updating fails because of a foreign key constraint

985912Jan 19 2013 — edited Jan 19 2013
Hello.

I have several tables in my data base however 3 are important. One of them is Employee(Employee_ID, Name, Last_Name and other irrelevant columns), Dentist(Employee_ID, Qualifications) and Assistant(Employee_ID, Qualifications).
I'm making an application in Oracle Application Express and upon attempting to update a row in the Employee table I get a ORA-20505: Error in DML: p_rowid=96, p_alt_rowid=Employee_ID, p_rowid2=, p_alt_rowid2=. ORA-02292: integrity constraint (DB.Dentist_CON) violated - child record found

Now, to begin with I had the same problems with deleting rows but I solved that by adding an on cascade delete to my foreign keys.
I have foreign key constraints both in my Dentist and Assistant tables in the Employee_ID columns and these are referencing Employee_ID in the Employee table.

When I'm updating anything within my form in Application Express, I haven't allowed the users to do anything to the primary key (Employee_ID) from my Employee table. So any changes that might happen are to columns irrelevant to the primary key. For instance, if I change the Name column of a particular row I can't update because I get the above-mentioned error.

I don't understand why this is happening.
If I could have any insight into why this is happening or help of any form I'd greatly appreciate it.

Thanks in advance.
This post has been answered by sb92075 on Jan 19 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 16 2013
Added on Jan 19 2013
7 comments
2,609 views