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: Chris Hamilton <chrish_at_cmprime.att.com>
Date: 1997/03/27
Message-ID: <01bc3ae1$b6459f80$2d89b687@chrish-pc.cis.att.com>#1/1

Tim Witort <trw_at_medicalert.org> wrote

> aramssb_svil wrote:
 

> > 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...." . . .
> Even if you can get the date to hold HUNDREDTHS of a second,
> one of these days you WILL get burned.
> . . . create a sequence . . .

I'll second that - I tried building a logging application last week to track changes made to certain tables during a migration process. To save transaction / logging time, I didn't create a numeric key - just tried to use a timestamp column with a default of SYSDATE. And I found that the date, even when TO_CHAR-ed out as far as possible, was NOT UNIQUE ENOUGH for me to apply the transactions to the new system in the exact proper sequence that they occurred. So I created a sequence (as Tim recommends above) and everything worked fine.

Chris



Chris Hamilton -- chrish_at_cmprime.att.com DBA, AT&T WorldNet Service - Lincroft, NJ http://www.serve.com/cowpb/chamilton.html Received on Thu Mar 27 1997 - 00:00:00 CST

Original text of this message

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