Re: Foreign Key Question

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: 22 Jan 2002 01:03:43 -0800
Message-ID: <a20d28ee.0201220103.1bda5180_at_posting.google.com>


chuck_jen49_at_yahoo.com (Chuck B) wrote in message news:<b1245bc4.0201211939.69464bf1_at_posting.google.com>...
> A simple question that I think I already know the answer to but I'll
> ask anyway.
>
> If I have a multi column primary key, can a foreign key reference a
> single column of that primary key? If so, how do you code it? Every
> way I have tried returns a 02270 error. If no, is there another way I
> can accomplish something similar such as a simple select in a CHECK
> constraint?
>
> Thanks,
> Chuck

A foreign key can not reference part of a primary key. Check constraints do not allow selects.
You'll need a trigger.

Hth

Sybrand Bakker
Senior Oracle DBA Received on Tue Jan 22 2002 - 10:03:43 CET

Original text of this message