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: Building a primary key

Re: Building a primary key

From: Tim Witort <trw_at_medicalert.org>
Date: 1997/03/27
Message-ID: <333AB7EB.56AE@medicalert.org>#1/1

aramssb_svil wrote:
>
> Hi there!!!
>
> I have a question that seem to be simple...
>
> I have to identify each row in my table with a unique key.
>
> In which way can i build this key without using a sequence???
>
> I heard a rumour about using a date, but i can't find the way to
> manipulate the date format of Oracle to obtain not seconds but fractions
> of this.

Whatever you do... do NOT use a DATE type column as a primary key (or any other key for that matter). I have seen this done with the assumption, "We will never create two orders within one second of each other...." Famous last words. I don't know what your aversion to sequences is, but this is exactly what they are for - create a sequence and populate a good old fashioned numeric column with it. Of course you'll also want to create a primary key constraint on that column. Even if you can get the date to hold HUNDREDTHS of a second, one of these days you WILL get burned.

Received on Thu Mar 27 1997 - 00:00:00 CST

Original text of this message

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