| How to add Oracle constraint to below tables [message #573947] |
Fri, 04 January 2013 09:03  |
 |
ravi_oracle_1413
Messages: 2 Registered: January 2013
|
Junior Member |
|
|
I have three tables:
A {op_id, op_name, .}
B {b_id, op_id, supplier_id, .}
C {c_id, op_id, op_id2, supplier_id, relation, .}
Table B and C have op_id which is foreign key from table A. In table A op_id is primary key, in table B b_id is primary key and in table C c_id is primary key. In table B supplier_id and op_id may have duplicate records. Now I want to add constraint so that if I delete records from Table B for op_id and if a relationship record exists for op_id in table C then it should not allow me to delete. Is it possible through referential integrity constraint ?
|
|
|
|
|
|
|
|
|
|
| Re: How to add Oracle constraint to below tables [message #573960 is a reply to message #573954] |
Fri, 04 January 2013 10:00   |
cookiemonster
Messages: 9152 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Michel Cadot wrote on Fri, 04 January 2013 15:19It is possible only if there is an actual referential integrity between C and B.
That is if there can't be an op_id in C that is not in B.
It sounds like op_id isn't unique in B so no foreign key is possible.
|
|
|
|
|
|