Message-Id: <10564.112551@fatcity.com> From: "Bala, Prakash" Date: Thu, 20 Jul 2000 13:05:43 -0400 Subject: RE: sequences 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@gelco.com [SMTP:Brian_McQuillan@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 on 07/12/2000 12:03:36 PM > > To: "Oracledba@Lazydba. Com" , > "Oracledba@Quickdoc. Co. > Uk" , ORACLE-L@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...