Skip to content

SQLException: ORA-02292: integrity constraint (SCHOOL.STUDENT_STAGE_FK) violated – child record found

Here i have a problem in my code when i want to delete a record:(student) from database and i know there is a related key
but i cannot solve this problem i tried deleting student that on the stage and this is the code:

here the schema

Advertisement

Answer

can you give more information about it?, normally that happens when you have a foregin key, in this case of the table STUDENT, you need to delete all rows in the other table first before delete STUDENT, you also can solve it, adding a delete on cascade, when you create the foregin key

you need then do the following:

also you can update the foregin key in the table for cascade delete:

Whith the update of the foregin key, deleting a studen, you also delete all the information of this student in the table STUDENT_STAGE

User contributions licensed under: CC BY-SA
9 People found this is helpful