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

Home -> Community -> Usenet -> c.d.o.server -> Trigger to set new record value from a sequence

Trigger to set new record value from a sequence

From: Tom Waterhouse <tomx.waterhouse_at_intel.com>
Date: Tue, 19 Dec 2000 13:58:38 -0800
Message-ID: <3A3FDA0E.3F799D55@intel.com>

Is there an elegant way to reference a sequence to set a value in a newly inserted record? Presumably this is done via a trigger.

I have been able to create a trigger, but have been unable to figure out how to update ONLY the newly inserted record with a sequence value.

My trigger is as follows:

BEGIN
update TBLUSERS set USERID=SEQ_TBLUSERID.nextval; END; Of course every record in the table is updated except the newly inserted record (it is a before trigger).

There must be a simple way to specify that I want to update the newly inserted record.

Any guidance would be appreciated.

Thanks,

Tom Received on Tue Dec 19 2000 - 15:58:38 CST

Original text of this message

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