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 -> Re: Trigger to set new record value from a sequence

Re: Trigger to set new record value from a sequence

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Tue, 19 Dec 2000 22:09:39 -0000
Message-ID: <977263590.4302.0.nnrp-01.9e984b29@news.demon.co.uk>

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>...

>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 - 16:09:39 CST

Original text of this message

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