Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2003

    Unanswered: table RDB.tblRm is mutating, trigger/function may not see it

    We have written a procedure sp_CloseRM which compares a datefield
    and if it expires with todays date then another procedure sp_deLink will be called in which we update some data of tblRM.

    And also we wrote a trigger which updates the values to null in tblRMS on update of tblRM.

    We have also created a job which runs once in a day and checks the date field in tblRM, if the date is equal to todays date then sp_deLink will be called.

    We have run this successfully on Oracle 8.1.6, when we run this on Oracle 7.3 we are getting the following error.

    "table RDB.tblRm is mutating, trigger/function may not see it"

    If anybody knows why this error occurs, please let me know. Its very urgnet.

    Please suggest is there any compatible code?

    Thanx in advance.

  2. #2
    Join Date
    May 2002

    Talking Re: table RDB.tblRm is mutating, trigger/function may not see it


    The common error is when u don't handle the trigger properly.
    A mutating table is one, that is currently being modified by an update, delete or a select statement.
    For example, if you r trigger contains a updates/select statement referencing the table its referencing off, you would get this error.
    Another reason, can be that if you are changing the primary, foreign keys of the table the trigger is firing from.


  3. #3
    Join Date
    Aug 2001
    London, UK

    Re: table RDB.tblRm is mutating, trigger/function may not see it

    This does come down to the underlying data being affected.

    I witnessed this when we had a trigger fire AFTER UPDATE... the trigger was then refering to the values inserted... after update triggers are physiclaly fired whilst the row is still being written, thus the table is mutating and the trigger errors.

    Oracle provides two pseudonyms to access the data though, so you shouldn't have to worry about this... :OLD and :NEW.

    So, if you have a table EMP with columns NAME and ID and you had a trigger firing after update, you could refer to the columns like this within the trigger:



    Being the version of the name prior to the update, and the version of the name after the update.

    By using the :OLD and :NEW objects you should be able to modify your trigger to avoid the classic ORA-04091 error.


    David K
    My homepage:
    My work:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts