Re: What is Best way to enforce Primary Keys

From: Michael Friedman <mfriedma_at_uucp>
Date: Tue, 11 Aug 1992 16:47:26 GMT
Message-ID: <1992Aug11.164726.15719_at_oracle.us.oracle.com>


In article <xy2m=fh.sjs_at_netcom.com> sjs_at_netcom.com (Stephen Schow) writes:

>For example, I am currently trying to figure out the best way to enforce
>primary keys...particularly when the primary key spans more than one field.
 

>But....The next 3 fields contain char,number,date values, the combination
>of which define a unique record. I need to make sure that the user does not
>enter duplicates of THAT unique entity.
 

>QUESTION: What is the best way to enforce this multi-field primary key?

Unless you are using version 7 of the database, the only way to totally enforce it is a unique concatenated index on those fields. This works well and the impact on performance is negligible.

If you don't like messy Oracle errors popping up in your forms then also include logic to check for dupes there, but the unique index should remain as your backup.

Mike

-- 
-------------------------------------------------------------------------------
I am not an official Oracle spokesman.  I speak for myself and no one else.
Received on Tue Aug 11 1992 - 18:47:26 CEST

Original text of this message