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

Home -> Community -> Usenet -> c.d.o.server -> Re: Foreign key to subset of records

Re: Foreign key to subset of records

From: Steve Long <steven.long_at_erols.com>
Date: Sun, 15 Apr 2001 20:31:02 -0400
Message-ID: <9bdela$t4p$1@bob.news.rcn.net>

you can effect the same result if you simple replace <constant> with a column and populate that column with a constant value. you can even use an insert trigger and a check constraint to enforce your value of <constant>.

"Evgeny Sorokin" <SSEEAA_at_MailAndNews.com> wrote in message news:3B17CF91_at_MailAndNews.com...
> May be it is a question, may be suggestion to Oracle.
> I want to create foreign key like this:
>
> alter table <table1> add
> constraint <constraint> foreign key (<field1>,<constant>)
> references <master-table> (<field2>,<field3>);
>
> Oracle must execute SQL like
>
> select ... from <master-table>
> where <field2>=:param1 and <field3>=<constant>
>
> on inserting or updating value of <table1>.<field1>
>
> In this case primary (or unique) key on <master-table> can be
> (<field2>,<field3>) or (<field2>).
>
> May be such option already exists in newest versions like 8.1.6 or 8.1.7?
> Thank you
>
Received on Sun Apr 15 2001 - 19:31:02 CDT

Original text of this message

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