Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Composite foreign key question
In article <977264993.714036_at_news.zipcon.net>,
"joebob" <joebob_at_zipcon.n0t> wrote:
> I've got a primary key made up of two columns. Is it possible to
create =
> a composite foreign key made up of the two pk columns and that
reference =
> individual primary keys in two separate tables? If so, please could
you =
> provide a little syntax ..
>
> Thank you
>
> --=20
> To reply directly, replace the zero in my email address with the
letter =
> e.
>
>
Reading from the manual,
alter table <table> modify constraint <constraint> foreign key ( <column1>, <column2> ) references <foreignTable> ( <foreignColumn> , <foreignColumn2> )
It is important if you really want to work on and with Oracle to spend some time reading the manuals and buy and read the auxillary texts. It is apparent to most of the answerers of these questions that most of the writers are not even attempting to read the manual.
This syntax is obviously not something most people would recall off the top of their head. However, it takes about 2 minutes to bring up the manual in PDF, lookup 'alter table' and follow the boxcar diagram to the logical conclusion.
-- Michael Krolewski Rosetta Inpharmatics mkrolewski_at_rii.com Usual disclaimers Sent via Deja.com http://www.deja.com/Received on Tue Dec 19 2000 - 17:48:14 CST