Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: first trigger, how do I incremement a value?
Try :
CREATE OR REPLACE TRIGGER SET_HOLDNR BEFORE
INSERT ON HOLDING FOR EACH ROW
BEGIN
UPDATE NMBRHOLDINGS SET <fieldname> = <fieldname> + 1;
END;
I assume that NMBRHOLDINGS is a table, fieldname a field NUMBER type.
And read a manual or the PL/SQL help.
Hth,
Ted
On Sat, 03 Mar 2001 19:19:59 GMT, "MadG" <patrick4133_at_hotmail.com>
wrote:
>Heya!
>
>It's my first trigger and I need a little help.
>
>I have to Create a trigger on the HOLDING table that will add 1 to the
>appropriate value in NMBRHOLDINGS when a row is inserted into the HOLDING
>table.
>
>But I don't know how to go about actually adding 1.
>
>All I have seen or can find is comparrisons, nothing with a +,
>
>can someone help me out or post a url that can help?
>
>Thanks in advance.
>
>Patrick.
>
>
EMail: knijff_at_bigfoot.com Received on Sat Mar 03 2001 - 14:14:27 CST