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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: sequences

Re: sequences

From: Regina Harter <rharter_at_emc-inc.com>
Date: Wed, 12 Jul 2000 11:10:32 -0700
Message-Id: <10556.111849@fatcity.com>


We have had problems in the past using triggers, usually related to the fact that the sequence value is a primary key. Since we insert usually through an application, if we don't need a reference to it at the time, it just goes into the insert statement as sequence_key.nextval, if the program needs a reference to the new row, we retrieve the sequence value into a variable and then include the variable in the insert command.

At 09:23 AM 7/12/00 -0800, you wrote:
>I wanted to ask how people are handling the insertion of unique keys in
>Oracle. Please understand that my experience with generating unique keys
>comes from an Informix background, wherein you can have a column with
>datatype of 'serial'. This is an integer column which gets generated at
>insert time with the next value automatically. You can then check the
>sqlca area (return buffer) for the inserted value.
>
>I know in Oracle you can accomplish this with the SEQUENCE function. As
>this is not automatically inserted by Oracle, how is the unqiue key value
>inserted? Do most people use a before trigger, stored procs, or call the
>sequence themselves? If using a client program (c, java), how is the
>value for the unique key returned to the program which performed the insert?
>
>Examples, methods, design recommendations welcome...
Received on Wed Jul 12 2000 - 13:10:32 CDT

Original text of this message

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