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 -> Non-primary key constraints in Oracle

Non-primary key constraints in Oracle

From: <ted_graham_at_mail.amsinc.com>
Date: Tue, 23 Jun 1998 13:55:45 GMT
Message-ID: <6moc51$b9p$1@nnrp1.dejanews.com>


Hello all:

I'm a developer without much database experience, and we are having a problem with setting up our tables.

We want to have Oracle inforce an integrity constraint between two tables, where the column that we want to inforce is only part of the primary key on the other table.

For example,
imagine a Car table, with a primary key of two columns: Model and Type.

CAR



Model Type
GX2          2-door
GX2          4-door

Then, in the Customer table, we want to track the Model of car that the customer has purchased. We want to make sure that the value in the Customer's Model column is valid (by checking it against Car:Model), but we don't care what Type of car the customer has.

Customer



Name Model
Joe          GX2              <---------Fine
Bob          GX1              <-------We want Oracle to catch this


Our DBAs say that this cannot be done, but we are having trouble believing that. Suggestions on how to accomplish this, or pointers to documentation would be great.

Currently, my only access to newsgroups is through DejaNews, so please copy my with any answers at Ted_Graham_at_mail.amsinc.com

TIA,
   Ted

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Tue Jun 23 1998 - 08:55:45 CDT

Original text of this message

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