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: Bala, Prakash <PBala_at_fitech-gso.com>
Date: Thu, 20 Jul 2000 13:05:43 -0400
Message-Id: <10564.112551@fatcity.com>


What if my trigger calls a procedure/function and this procedure inserts a row using the sequence generator. Will this still slow down the write? If so, is there any remedy?

Thanks
Prakash

> -----Original Message-----
> From: Brian_McQuillan_at_gelco.com [SMTP:Brian_McQuillan_at_gelco.com]
> Sent: Wednesday, July 12, 2000 2:17 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Re: sequences
>
> I use sequences to insert unique keys, to get the next value of the
> sequence
> typically I use it within PL/SQL scripts as follows
>
> select sequence_name.nextval
> into a_variable
> from dual;
>
> you can use it within triggers (which is basically a PL/SQL block) but I
> have
> heard that the use of sequences
> within triggers is discouraged , this came form a source at Oracle ,
> perhaps some of you other listers could confirm if it's still a bad idea
> in 8i
> ??
>
> hope this helps
> Brian.
>
>
>
>
>
> Glenn Travis <Glenn.Travis_at_wcom.com> on 07/12/2000 12:03:36 PM
>
> To: "Oracledba_at_Lazydba. Com" <oracledba_at_lazydba.com>,
> "Oracledba_at_Quickdoc. Co.
> Uk" <oracledba_at_quickdoc.co.uk>, ORACLE-L_at_fatcity.com
> cc: (bcc: Brian McQuillan/GELCO)
>
>
>
>
> 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 Thu Jul 20 2000 - 12:05:43 CDT

Original text of this message

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