Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Trigger to set new record value from a sequence
Have a look at my website in the FAQ section for details and peripheral comments.
-- Jonathan Lewis Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk Practical Oracle 8i: Building Efficient Databases Publishers: Addison-Wesley See a first review at: http://www.ixora.com.au/resources/index.htm#practical_8i More reviews at: http://www.jlcomp.demon.co.uk/book_rev.html Tom Waterhouse wrote in message <3A3FDA0E.3F799D55_at_intel.com>...Received on Tue Dec 19 2000 - 16:09:39 CST
>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
>