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: foreing key on part of a primary key

Re: foreing key on part of a primary key

From: Rod Stewart <rod.stewart_at_afp.gov.au>
Date: Thu, 9 Sep 1999 16:46:11 +1000
Message-ID: <7r7la4$5j9$1@platinum.sge.net>


Perhaps you could add a surrogat primary key and avoid the whole issue? This way the language is just part of a lookup and you place a unique key on a combination of language and code to ensure integrity within the table. This is a more flexible structure in the long run. Your table might then look like:

create table example_table(
id number not null,
code varchar2(30) not null,
language number not null,
CONSTRAINT example_table_PK
  PRIMARY KEY ( ID ),
constraint example_table_UK
  UNIQUE (code, language)
  using index);

HTH Rod J. Stewart

Stephane sinet <sinet_at_auto-contact.com> wrote in message news:7r5qi3$1as$1_at_minus.oleane.net...
> Hello,
> I have to develop a multilanguage software, so all tables containing a
label
> have
> a primary key with code + code language.
> ex : my table COLOR -> code color, code language, label color
> However i don't want to have the code language in all other tables who
> reference the color.
> How can i do, to refer to the color and have the constraint, i.e to forbid
> the delete of a color if it is referenced by another table.
> Thanks.
>
>
Received on Thu Sep 09 1999 - 01:46:11 CDT

Original text of this message

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