Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Surrogate Key vs Production Key

Re: Surrogate Key vs Production Key

From: Dusan Bolek <pagesflames_at_usa.net>
Date: 6 Oct 2004 05:00:16 -0700
Message-ID: <1e8276d6.0410060400.4f4ac23f@posting.google.com>


krislioe_at_gmail.com (xtanto) wrote in message news:<e1c9bd55.0410052139.2c139132_at_posting.google.com>...
> Hi Gurus,
>
> I have a transaction table having unique external document number. It
> can be assured that it is unique. It is a varchar2(30).
> This is a header-detail transaction.
>
> The options is :
> Whether I should use this unique external document table as PK ?
> (means I have also to store this value in Detail table)
> OR
> Should I create an ID based on Sequence as 'Surrogate' PK ?
>
> What is the cost/benefit ?

The biggest problem of not using surrogates is that you do not have the control over used key values. In this particular case it's going to be funny when you will get another external resource for these documents with overlapping keys.
I'm recommending to use external keys only for world wide accepted keys that are enforced by laws, compliance rules etc. (such as social numbers, ZIP codes, ...), I would never use external key based just on someone else design.

--
Dusan Bolek
http://www.db-support.com

Email: spambin_at_seznam.cz
Pls add "Not Guilty" to the subject, otherwise your email will face an
unpleasant end as SPAM.
Received on Wed Oct 06 2004 - 07:00:16 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US