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 -> Re: Foreign composite keys

Re: Foreign composite keys

From: Joost Ouwerkerk <owrkrj_at_mailhub.sickkids.on.ca>
Date: 1997/06/17
Message-ID: <33a6bfcb.15081581@resunix.sickkids.on.ca>#1/1

Give your constraint a name so that you can track it effectively, and also specify the table for foreign key to reference. Try this:

CREATE TABLE account

(server 	VARCHAR2(15),
memory          VARCHAR2(15),
classification  VARCHAR2(15),
user_id         VARCHAR2(15),   
password        VARCHAR2(15),

CONSTRAINT user_id_passwd_fk
FOREIGN KEY (user_id,password)
REFERENCES passwords(user_id,password)
);

That should do it.

Joost Ouwerkerk
Development Analyst
HSC Foundation

On Tue, 17 Jun 1997 09:11:32 -0400, Gabe Goldhirsh <ggoldh1_at_triton.towson.edu> wrote:

>In ORACLE 7, what is the syntax for constructing a foreign composite
>key, so far I have: [and am still getting an error]
>DROP TABLE account;
>CREATE TABLE account
>(
>server VARCHAR2(15),
>memory VARCHAR2(15),
>classification VARCHAR2(15),
>user_id VARCHAR2(15),
>password VARCHAR2(15),
>FOREIGN KEY (user_id)
>AND FOREIGN KEY (password)
>);
Received on Tue Jun 17 1997 - 00:00:00 CDT

Original text of this message

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