Oracle FAQ Your Portal to the Oracle Knowledge Grid

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

Re: sequences

From: Jared Still <>
Date: Tue, 18 Jul 2000 10:18:12 -0700 (PDT)
Message-Id: <>

What kind of problems did you have?

I've used triggers to insert Pk sequence values many times without any problems. Many others on the list have done this as well.


On Wed, 12 Jul 2000, Regina Harter wrote:

> 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...
> >
> --
> Author: Regina Harter
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).

Jared Still
Certified Oracle DBA and Part Time Perl Evangelist ;-) Regence BlueCross BlueShield of Oregon - Work - preferred address Received on Tue Jul 18 2000 - 12:18:12 CDT

Original text of this message