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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Trigger

Re: Trigger

From: Daniel A. Morgan <Daniel.Morgan_at_attws.com>
Date: Fri, 29 Jun 2001 10:15:20 -0700
Message-ID: <3B3CB7A8.6485B36F@attws.com>

kpdp wrote:

> Hello,
>
> I want to make a trigger which does in a table :
> Colunm 3 = Colunm 2 + Colunm 1 each time I update Column 2 or Column 1
>
> If tried without success:
>
> CREATE TRIGGER my_trigger
> AFTER
> UPDATE OF my_col1, my_col2 ON my_table
> FOR EACH ROW
> BEGIN
> UPDATE my_table SET my_col3 = my_col1 + my_col2 ;
> END;
>
> It doesn't work, do you have an idea ?
>
> Thanks in advance

Write something like this.

:NEW.my_col3 := :NEW.my_col1 + :NEW.my_col2;

A trigger is no place for an update statement on the host table.

Daniel A. Morgan Received on Fri Jun 29 2001 - 12:15:20 CDT

Original text of this message

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