Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Trigger to set new record value from a sequence
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