Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Primary Key of type string ?
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
![]() |
![]() |