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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Entering generated unique value.

Re: Entering generated unique value.

From: Brian Tkatch <SPAMBLOCK.Maxwell_Smart_at_ThePentagon.com.SPAMBLOCK>
Date: Tue, 06 Feb 2001 13:41:26 GMT
Message-ID: <3a7ffcc9.2404596094@news.alt.net>

On Mon, 05 Feb 2001 21:57:13 -0800, "Daniel A. Morgan" <dmorgan_at_exesolutions.com> wrote:

>From a functional stand point I do not understand what you are trying to do.
>But if you want a unique value for an index sequences are the answer. If you
>want unique values that are not numeric ... either apply TO_CHAR() or BITAND.
>
>Dan Morgan

I am trying to have an id for rows, where the id is not recognizable as having any meaning.

Imagine a session id on a website that let's you read email or has a shopping cart. If the session ids were in any way sequential, someone would be able to mess up someone else's session. Therefore the number has to be completely random.

In a similiar fasion, I need a completely unique id for each record, besides the usual sequence based id. I happen to have such a function, and have been using it for quite a while. I am just concerned that as the databse gets hit my more and more people, the time-lapse inbetween checking if an id is unique and entering it may allow for another process to add the exact same id causing the insert to fail.

Maybe this will help explain the process.

  1. Process-A: Generates id 'opIJ097hnyL'.
  2. Process-B: Generates id 'opIJ097hnyL'.
  3. Process-A: Checks if id 'opIJ097hnyL' is unique.
  4. Oracle: tells Process-A that is is unique.
  5. Process-B: Checks if id 'opIJ097hnyL' is unique.
  6. Oracle: tells Process-B that is is unique.
  7. Process-A: Inserts the record with the unique id.
  8. Process-B: Inserts the record with the now non-unique id.
  9. Process-B has an error that it doesn't know how to deal with.

I am just looking for ideas on how to guarantee unique ids, or at least be able to handle the possible insert error.

Brian Received on Tue Feb 06 2001 - 07:41:26 CST

Original text of this message

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