Check constraints Foreign Key
Date: 2 Dec 1994 02:15:53 GMT
Message-ID: <3bm00p$dkg_at_martha.utk.edu>
Could anyone explain me how exactly the "FOREIGH KEY" constraint serves?
Assuming that, I've tryed use to values from the master table for CHECK contstraints in other fields of the dependent table.
I wrote this:
create table JOBS (
JCODE char(4) not null PRIMARY KEY ,
MIN_PAY number(7) not null,
MAX_PAY number(7) not null
);
create table ASSIGNMENT (
EID char(5) not null,
JCODE REFERENCES jobs(jcode),
SALARY number(7)
check( salary >= jobs(MIN_PAY) and salary <= jobs(MAX_PAY))
FOREIGN KEY EID,JCODE EMPLOYEE(EID), JOBS(JCODE),
PRIMARE KEY (EID,JCODE)
);
I expect jobs(MAX_PAY) and jobs(MIN_PAY) be definite single values because of the PRIMARY KEY/FOREIGN KEY constraints.
ORACLE does not let to use other table's columns in check statment. Why this could not work?
-- David Zlotchenko Computer Science Undergraduate Student Assistant Research Services The University of Tennessee Phone: (615) 974-2909 211 Hoskins Library Email: zlotchen_at_solar.rtd.utk.edu Knoxville, TN 37996 s_dzlotchenk_at_pstcc.cc.tn.usReceived on Fri Dec 02 1994 - 03:15:53 CET