I am getting an exception
ORA-02291: integrity constraint (ADS.ADS_JOB_FAMILIES_F03) violated - parent key not found
I found the constraint in the table am inserting.
How to find the parent and child keys...(Columns).
Note:Am using Oracle
I am getting an exception
ORA-02291: integrity constraint (ADS.ADS_JOB_FAMILIES_F03) violated - parent key not found
I found the constraint in the table am inserting.
How to find the parent and child keys...(Columns).
Note:Am using Oracle
For the parent table:
select * from all_constraints
where constraint_name in (
select R_CONSTRAINT_NAME
from all_constraints
where constraint_name = 'ADS_JOB_FAMILIES_F03');
For the parent column:
select *
from all_cons_columns
where constraint_name in (
select constraint_name
from all_constraints
where constraint_name in (
select R_CONSTRAINT_NAME
from all_constraints
where constraint_name = 'ADS_JOB_FAMILIES_F03'));
This is not totally perfect because it disregards the owner of the constraints. But I think it will work for you.
Edit: I now even found this. Which would give a query like this:
SELECT a.table_name, a.column_name, a.constraint_name, c.owner,
-- referenced pk
c.r_owner, c_pk.table_name r_table_name, c_pk.constraint_name r_pk
FROM all_cons_columns a
JOIN all_constraints c ON a.owner = c.owner
AND a.constraint_name = c.constraint_name
JOIN all_constraints c_pk ON c.r_owner = c_pk.owner
AND c.r_constraint_name = c_pk.constraint_name
WHERE a.constraint_name = 'ADS_JOB_FAMILIES_F03';