| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Composite Key Problem?
I am trying to design queries to help determine different
levels of matching records. I have a table of the following form
TABLE 1
ID NOT NULL VARCHAR2(32) LNAME NOT NULL VARCHAR2(32) FNAME NOT NULL VARCHAR2(32) MNAME NOT NULL VARCHAR2(32) DOB NOT NULL DATE SEX NOT NULL VARCHAR2(32) RACE NOT NULL VARCHAR2(32) ADDRESS NOT NULL VARCHAR2(128) PHONE NOT NULL VARCHAR2(32) ACCT NOT NULL VARCHAR2(32) SSN NOT NULL VARCHAR2(32)
This table has about 500,000 entires
I have created a new table based on the first with this form
TABLE 2
IDA NOT NULL VARCHAR2(32) IDB NOT NULL VARCHAR2(32) LNAME NOT NULL VARCHAR2(32) FNAME NOT NULL VARCHAR2(32) MNAME NOT NULL VARCHAR2(32) DOB NOT NULL DATE SEX NOT NULL VARCHAR2(32) RACE NOT NULL VARCHAR2(32) ADDRESS NOT NULL VARCHAR2(128) PHONE NOT NULL VARCHAR2(32) ACCT NOT NULL VARCHAR2(32) SSN NOT NULL VARCHAR2(32)
Table 2 has a composite key of (IDA, LNAME, FNAME, DOB, SEX)
I then run my plsql program that marches down a cursor made up of table1 and does a select against another cursor made up of table1 in an inner loop. The second cursor select statement looks like this: select * from table1
where a.lname = b.lname and a.fname = b.fname and a.dob = b.dob and a.sex = b.sex and a.mrn != b.mrn
Without the primary constraint on the table I get 25,964 of records. With the primary key constraint I get 72. This can not be right. Can anyone shed some light on this.
Thanks
Joe Condle
System Engineer
Medical ARchival Systems Inc.
University of Pittsburgh Medical Center
Received on Tue May 05 1998 - 12:02:53 CDT
![]() |
![]() |