I am not sure how to create a one to many relationship, but restrict the many items as a "set" to each unique primary key.
DB: Oracle 11g
Example:
PK Table:
CUST(PK)
100
200
Valid FK Table Data:
CUST(FK) | ITEM
100 | 101
100 | 102
200 | 101
200 | 102
Invalid FK Table Data:
CUST(FK) | ITEM
100 | 101
100 | 101
200 | 104
200 | 104
Any suggestions how to setup such a relationship? I'd like to limit the uniqueness so it is not possible to add a value to the FK table that violates the above "set" uniqueness.
Can this be done purely on the Oracle DB end, or must I enforce this from the accessing Java code?