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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Primary Key of type string ?

Re: Primary Key of type string ?

From: Walt <walt_askier_at_SHOESyahoo.com>
Date: Thu, 31 May 2007 10:44:57 -0400
Message-ID: <135tnr9g2hnl500@corp.supernews.com>


Mark D Powell wrote:
> On May 31, 7:41 am, Robert Klemme <shortcut..._at_googlemail.com> wrote:
>> On 31.05.2007 11:26, sybrandb wrote:
>>> On May 31, 11:03 am, "Oriane" <ori..._at_guermantes.fr> wrote: (aggressive snipping)

>>>> Just a basic question from a beginner in Oracle. Is is the "standard choice"
>>>> to use a column of type "int" for the primary key ? I suppose that this is a
>>>> performance issue ? What about choosing a type "string/char" for a primary
>>>> key ?

>>> The standard choice is a number(10).

>> And I thought the standard choice would be the key dictated by business >> requirements...

> I vote with Robert. Wherever possible you should use business values
> as the PK. Only if the business value is subject to being changed
> would I consider using an artificial key.

I beg to differ: Is there such a thing as a business value that is not subject to change?

Except for simple small code tables, use an ordinal (Number(10) is good), generated by a sequence. Do not put "meaningful" data in your primary key, because everything that has external meaning is subject to change and should be an attribute, not a key.

A classic example is Social Security Number - if you've used that as a primary key for your person table, you're in a world of hurt.

//Walt Received on Thu May 31 2007 - 09:44:57 CDT

Original text of this message

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