Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: TRIGGER BEFORE UPDATE
By simply coding:
CREATE OR REPLACE TRIGGER htbvz
BEFORE UPDATE ON table FOR EACH ROW WHEN (new.bvz = 'Y') BEGIN :new.status := 'C'; END;
You can change the value of any of the :new variables in the BEFORE, FOR EACH ROW trigger. You don't need to do an update....
On Tue, 17 Dec 1996 14:40:20 +0100, Wolf Kammer <uzr10a_at_work6c.rhrz.uni-bonn.de> wrote:
>Hallo to who is looking at this,
>
>I must set the value of the columne "status" to 'C' ("Changed") as
>soon as an other column has been updated. My trigger
>
>CREATE OR REPLACE TRIGGER htbvz
>
> BEFORE UPDATE ON table
> FOR EACH ROW WHEN (new.bvz = 'Y')
> BEGIN
> UPDATE table SET status='C' WHERE :new.bvz='Y';
> END;
>/
>
>does not work since the table is mutating, that is being modified
>by the update. How can one do this simple thing?
>
>Thanks for any help, Wolf Kammer
>
Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com