CREATE TABLE I_DONT_LIKE_MASTER 
( CODE_TYPE VARCHAR2(4) NOT NULL,
CODE_VALUE VARCHAR2(3) NOT NULL,
CODE_DESC VARCHAR2(20) ,
PRIMARY KEY (CODE_TYPE, CODE_VALUE) )

SPLT    N       SDFLJDSL
SPLT    FP      SDFSDKFDS
SPLT    OBG     SFLSDJFSD
TYPE    MD      SDFLSDFSDF
TYPE    FP      SDFJDSFJ
TYPE    OPH     SDLFJDSKF


CREATE TABLE DOCTOR
(.....,
SPECIALITY_CODE_TYPE    VARCHAR2(4),
SPECIALITY_CODE_VALUE   VARCHAR2(3),
TYPE_CODE_TYPE          VARCHAR2(4),
TYPE_CODE_VALUE         VARCHAR2(3),
.....,
foreign key  (SPECIALITY_CODE_TYPE,SPECIALITY_CODE_VALUE) references
I_DONT_LIKE_MASTER,
foreign key  (TYPE_CODE_TYPE, TYPE_CODE_VALUE ) references
I_DONT_LIKE_MASTER )

D1      SPLT    N       TYPE    OPH
D2      SPLT  N TYPE    MD


but u can also create surrogate key and make (CODE_TYPE, CODE_VALUE) as
alternate key (unique) and then reference the surrogate key in ur doctor
table, instead of two cols as one foreign key
-MANDAR 


-----Original Message-----
Sent: Friday, March 23, 2001 7:31 PM
To: Multiple recipients of list ORACLE-L


I'm still not quite sure I understand the "single code table" business. Let
me give an example (taken from a live example at one of my previous jobs).
I have a table called DOCTOR that has two fields - SPECIALTY and TYPE. 
The acceptable values for SPECIALTY are N, FP, OBG, etc... 
The acceptable values for TYPE are MD, FP, OPH, etc... 
If I have a "single code table", how can I create a Foreign key constraint
on the SPECIALTY column and another one on the TYPE column?
------ 
Jacques R. Kilchoer 
(949) 754-8816 
Quest Software, Inc. 
8001 Irvine Center Drive 
Irvine, California 92618 
U.S.A. 
http://www.quest.com 
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Mandar Ghosalkar
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to