Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Foreign "Key" confusion

Foreign "Key" confusion

From: Martin T. <bilbothebagginsbab5_at_freenet.de>
Date: 15 Sep 2006 00:08:23 -0700
Message-ID: <1158304103.303663.103850@i3g2000cwc.googlegroups.com>


Hi all.
(Oracle 9.2.0.1.0, Windows XP)

I was wondering how I could restrict the values of a column in a child table to a parent column when that parent column is NOT unique. I know a foreign key can only be used to reference a unique (set of) columns.

What could I do to enforce child <-> parent relationship for a non-unique parent column?

Example:



Parent table "texts":
columns = (TEXT_ID | LANGUAGE_ID | TEXT) pk = TEXT_ID&LANGUAGE_ID

referencing, "child" table:
columns = (TEXT_ID | EVENT_ID | ...)
pk = EVENT_ID
contraint = "the text_id must be a text_id existing in the "texts" table"

Thanks for any tips on how to do this or any pointers to resources where such problems are discussed!

best,
Martin

p.s.: Just for the record, no, this is not homework :) Received on Fri Sep 15 2006 - 02:08:23 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US