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: John Strange <jstrange_at_imtn.dsccc.com>
Date: 1997/04/03
Message-ID: <5i08us$8s9@camelot.dsccc.com>#1/1

The down side to the " max(primarykeyfield)+1." operation is that user 1 could do an insert on a record, start a new record.

User 2 does an insert and commit;

User 1 finishes their second record, hits commit and errors out because user 1's record 1 has the same primary key value as user's 2 record.

Use the sequence generator, with no cache.

mlarson (mdlarson_at_brain.uccs.edu) wrote:
: You could build a insert trigger that will make the primary key column
: something
: like max(primarykeyfield)+1. This does the same as a sequence without
: the chance of losing alot of values. You can also use the
: DBMS_UTILITY.GET_TIME function in the trigger statement which gives the
: time up to hundredths of a second.
 

: Read about it on pg511 of PL/SQL ORACLE BOOK (by oracle press)
 

: 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.
: If someone have some suggest, please e-mail me or post an answer.
: Thanks in advance
 

: ---
: Danilo Riccitelli & Andrea Pallotta
: Development Team - Digital Italy

--
This posting represents the personal opinions of the author. It is not the
official opinion or policy of the author's employer. Warranty expired when you
opened this article and I will not be responsible for its contents or use.
Received on Thu Apr 03 1997 - 00:00:00 CST

Original text of this message

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