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: Is the use of VARCHAR(256) as Primary Keys preferred in Oracle?

Re: Is the use of VARCHAR(256) as Primary Keys preferred in Oracle?

From: Justin Cave <jocave_at_yahoo.com>
Date: 18 Nov 2002 14:23:53 -0800
Message-ID: <233b7a65.0211181423.76a103f9@posting.google.com>


Jim <no-spam_at_no-spam.org> wrote in message news:<lh1itu0ibhtnjt28jal4ne6ou7e6j1n267_at_4ax.com>...
> I confess I don't understand the preference for the use of a surrogate
> key instead of a natural key except in special cases.
>
> I can see that a surrogate, "artificial" key would have some value IF
> all "natural" columns in a table must be updatable, IF no 'natural'
> column, or reasonable combination of 'natural' columns, would be
> unique, and IF all updating of the table would be perfomed by
> application programs able to deal with the essentially meaningless
> surrogate key.

I believe the thinking goes thusly:
Q: How do we determine that a column or reasonable combination of columns will be unique?
A: We look at the business logic. The business logic says that column foo is unique.

Q: What happens when the business logic changes and foo is no longer unique?

At this point, it's a lot easier if your primary keys don't have to change to accomodate the change in business logic.

Justin Cave

>
> On the other hand, use of a 'natural' key composed of column(s)
> understood and meaningful to the user would, it seems to me, yield a
> more straightforward, easier for the user to understand design.
>
> Am I missing something (probably)?
Received on Mon Nov 18 2002 - 16:23:53 CST

Original text of this message

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