Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Avoid foreign key inconcistencies while deleting a table enttry.

Former Member
0 Likes
541

Hi,

When we have a master table which also acts as a check table for the foreign keys of other dependant tables.

If we delete an entry from the check table which already resides in the foeign key table as reference, data integral inconsistency is introduced.

Eg, If the airline booking tale contains a foreign key to airline master table CONNID.

In airline booking table, lot of entries for the airline 'LH' exists which refers to the airline master for 'LH' airline.

Now if we directly delete the entry 'LH' from the airline master, all the entries referring to 'LH' in booking table becomes inconsistent.

Could you please suggest how to avoid this?? Do we have some config in the table(DDIC) which could avoid this.

Thanks

Hi,

When we have a master table which also acts as a check table for the foreign keys of other dependant tables.

If we delete an entry from the check table which already resides in the foeign key table as reference, data integral inconsistency is introduced.

Eg, If the airline booking tale contains a foreign key to airline master table CONNID.

In airline booking table, lot of entries for the airline 'LH' exists which refers to the airline master for 'LH' airline.

Now if we directly delete the entry 'LH' from the airline master, all the entries referring to 'LH' in booking table becomes inconsistent.

Could you please suggest how to avoid this?? Do we have some config in the table(DDIC) which could avoid this.

Thanks

1 REPLY 1
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
484

This could be handled properly by creating view cluster.

Generate a manitenance view , join the tables, set the secondary tables as subset to the primary table.

The keys must be properly related.