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 -> Update Trigger - Mutating Table Problem

Update Trigger - Mutating Table Problem

From: <berj_kacherian_at_hotmail.com>
Date: 2000/04/28
Message-ID: <8ed4e4$vog$1@nnrp1.deja.com>#1/1

Here is the problem in one statement, I am getting ORA-04091.

Here is what I am trying to accomplish: We would like to track when the last time was that a customer updated their info. The customer table has a LAST_UPDATED field in it. During inserts we can set a default value for it. But the default value does not work during updates. So each time a row in the customer table is updated I have a trigger trying to update the LAST_UPDATED column. But this results in an ORA-04091. I guess because they are both accessing the same table.

Here is what the trigger looks like:

create trigger customer_upd after update of name,address,city,state,zip on customer for each row
begin update customer set last_updated=sysdate where id=:new.id; end;

Is there another way to do this?

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri Apr 28 2000 - 00:00:00 CDT

Original text of this message

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