referential integrity constraints in db2 os/390 v6.1

Maximiliano Alvarez

referential integrity constraints in db2 os/390 v6.1
At least in theory, in db2 os/390 v6.1 foreign keys can reference to a
unique key on a parent table. However, it is not clear whether it is
possible to have two foreign keys: one of them referencing to the primary
key on the parent table and the other one referencing to a unique key on the
same parent table.

has anyone tried this successfully?



Tim Lowe

Re: referential integrity constraints in db2 os/390 v6.1
(in response to Maximiliano Alvarez)
Oscar,
I don't see a problem with what you are suggesting, foreign keys certainly
can reference a table without a primary key in DB2 V6 as long as a unique
index exists on those columns.
However, I have been told that DB2 V7 adds a new wrinkle to this, "foreign
keys must now reference a parent key or unique key". This does not mean
just having a unique index, but having a unique constraint on the table.
And, since tables cannot be altered to add unique key constraints until V7,
it might be interesting. Not a problem, but if you go this way, you
should be aware of it.
However, if I had a choice, I would rather see the foreign keys referencing
primary keys.

I hope this helps.

Thanks,
Tim



"Alvarez,
Oscar M." To: [login to unmask email]
<MAXIMILIANO@I cc:
ADB.ORG> Subject: referential integrity constraints in
Sent by: DB2 db2 os/390 v6.1
Data Base
Discussion
List
<[login to unmask email]
M>


01/10/2002
04:33 PM
Please respond
to DB2 Data
Base
Discussion
List






At least in theory, in db2 os/390 v6.1 foreign keys can reference to a
unique key on a parent table. However, it is not clear whether it is
possible to have two foreign keys: one of them referencing to the primary
key on the parent table and the other one referencing to a unique key on
the
same parent table.

has anyone tried this successfully?