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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Triggers and sequences

Re: Triggers and sequences

From: Mike Burden <michael.burden_at_capgemini.co.uk>
Date: Tue, 02 Mar 1999 11:21:05 +0000
Message-ID: <36DBC99F.B893B2FF@capgemini.co.uk>


Can you not use the colum DEFAULT instead of a trigger. Hopefully performs better.

Will sequence.CURRVAL not give you what you want. This value should be the value your session last used, I think.

Peter Almond wrote:

> I'm considering using a sequence to generate primary keys in a database, and
> generating them in a "BEFORE INSERT" trigger. I have tried this out and it
> works.
>
> It seems like a good idea, because it means the logic is in one place, and
> the client application generating rows doesn't have to worry about how to
> get the next sequence number.
>
> BUT !
>
> How does the client program GET the sequence number after adding a row ?. If
> child records are being added at the same time, I have to know the primary
> key of the parent so I can set the foreign key values.
>
> I am using various methods of accessing the db, including Pro*C , OO4O (VB)
> and PL/SQL.
>
> I'm looking for a good general approach to this. What do others do ?
>
> Any help much appreciated,
>
> Pete
Received on Tue Mar 02 1999 - 05:21:05 CST

Original text of this message

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