Re: ora-04091, updating same table in trigger
Date: Mon, 20 Apr 2009 16:45:04 +0100
Rather than updating the row, use a BEFORE ROW trigger simply to set the column value in the trigger - it will get applied when the update is processed. See examples in docs, eg:
CREATE OR REPLACE TRIGGER emp_sal_trg
BEFORE UPDATE ON emp
FOR EACH ROW
IF :NEW.Comm IS NULL and :NEW.Job = 'SALES' THEN :New.Comm := :New.Sal * 0.1;
END; (docs for 9iR2 :15 Using
2009/4/20 Harvinder Singh <Harvinder_Singh_at_picis.com>
> Currently insert into a table is failing with error ora-04091 and it
> looks like after-row insert/update trigger is trying to update the same
> table, for example if we try to insert row into table and 1 column is
> empty then in trigger based on some logic we update that column for same
> How can we fix this issue, Is there any workaround so that we can update
> the same table in the trigger?
> The information in this email is confidential and may be legally
> privileged. It is intended solely for the addressee. Access or use by any
> other person to this internet email is not authorized and may be unlawful.
> If you are not the intended recipient, please delete or destroy this email.
> If you do not wish to receive future emails from this sender, please reply
> directly to this email requesting you be removed from any mailing list.