Sql Error: Ora-02298: Cannot Validate (System.Aeropuerto_Fk) - Parent Keys Not Found

SQL Error: ORA-02298: cannot validate (SYSTEM.AEROPUERTO_FK) - parent keys not found

There are records in AEROPUERTO that point to records that do not exist in CIUDAD.

To find out which records of AEROPUERTO have that kind of issue:

select * from AEROPUERTO where CODIGO_CIUDAD not in (select CODIGO from CIUDAD)

If the result set is not empty, you do have orphanaged records. You'll need to add the missing CIUDAD records in order to create the AEROPUERTO_FK foreign key, or update all the erroneous AEROPUERTO.CODIGO_CIUDAD to null (if this is a nullable field, but you will lose the city information for those airport records).

Why is parent key not found?

The error message may be a bit cryptic at first, but it is pretty clear.

The only difference between the two INSERTs is for HARDWARE_ID. Hence 'H0002' is not a valid HARDWARE_ID. It is not in the HARDWARE table.

Error Code 1452 When attempting to Alter Table Constraint

Use this to find out what entry is screwing things up

SELECT CHAR_TRIP, CHAR_DESTINATION 
FROM charter
WHERE CHAR_DESTINATION NOT IN (
SELECT AIRPORT_CODE FROM airport);

ORA-02298 - Parent keys not found when enable constraint

It appears you are migrating detail records without ensuring that all the foreign key values are present in the referenced tables. If this is the case then you need to migrate records from REGION@SOURCE_DB into REGION@TARGET_DB before you migrate the COUNTRY records.



Related Topics



Leave a reply



Submit