Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Single Code Table or Separate Code tables dilemma
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),
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?
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Mandar Ghosalkar INET: MandarG_at_gsr-inc.com 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: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-LReceived on Fri Mar 23 2001 - 19:53:21 CST
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
![]() |
![]() |