I have 2 tables as follows
Table A
DATETIME NOT NULL DATE
REG_NO NOT NULL CHAR(6)
....
constraint pk_a primary key (reg_no, datetime),
Table Audit
DATETIME NOT NULL DATE
REG_NO NOT NULL CHAR(6)
....
constraint fk_audit foreign key (reg_no, datetime) references a
when I try to delete the records in audit and table A,
I got the errors
ORA-02291: integrity constraint (my_package.FK_AUDIT) violated - parent key not found
Sample of my codes are as follows
select mod_datetime into v_mod_datetime
from A where
datetime = p_datetime
AND reg_no = v_reg_no
for update nowait;
-- delete audit
delete from offence_audit where
datetime = p_datetime
AND reg_no = v_reg_no;
-- delete A
delete from A where
datetime = p_datetime
AND reg_no = v_reg_no;
what could be the problem?
Table A
DATETIME NOT NULL DATE
REG_NO NOT NULL CHAR(6)
....
constraint pk_a primary key (reg_no, datetime),
Table Audit
DATETIME NOT NULL DATE
REG_NO NOT NULL CHAR(6)
....
constraint fk_audit foreign key (reg_no, datetime) references a
when I try to delete the records in audit and table A,
I got the errors
ORA-02291: integrity constraint (my_package.FK_AUDIT) violated - parent key not found
Sample of my codes are as follows
select mod_datetime into v_mod_datetime
from A where
datetime = p_datetime
AND reg_no = v_reg_no
for update nowait;
-- delete audit
delete from offence_audit where
datetime = p_datetime
AND reg_no = v_reg_no;
-- delete A
delete from A where
datetime = p_datetime
AND reg_no = v_reg_no;
what could be the problem?