Foreign Key Relationship and Join Condition 
A view containing the base tables TAB1 and TAB2 is defined. TAB1 is the primary table of the view. TAB2 is the secondary table of the view. TAB1 is the check table for TAB2.
The foreign key fields are assigned to the check table fields as follows:
Check table field |
Foreign key field |
TAB1-FIELD_A |
TAB2-FIELD_1 |
TAB1-FIELD_B |
TAB2-FIELD_2 |
The join condition of the view generated from the foreign key is then:
CREATE VIEW... AS SELECT... WHERE TAB2-FIELD_1 = TAB1-FIELD_A AND TAB2-FIELD_2 = TAB1-FIELD_B.
You can also generate join conditions from generic and constant foreign keys:
Check table field |
Foreign key field |
TAB1-FIELD_A |
TAB2-FIELD_1 |
TAB1-FIELD_B |
generic |
TAB1-FIELD_C |
constant: ‘C’ |
The join condition for the view generated from the foreign key is in this case:
CREATE VIEW... AS SELECT... WHERE TAB2-FIELD_1 = TAB1-FIELD_A AND TAB2-FIELD_2 = ‘C’.
No join condition is specified for the generic relationship.