Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2012
    Posts
    9

    table %s.%s is mutating, trigger/function may not see it errors

    Greetings all,

    It has been a long time since I have used Oracle and PL-SQL. I created a reference table with a single varchar(10) PRIMARY KEY. There are other 2 datetime fields populated with SYSDATE values. I am trying to delete a record based a certain primary key value below.

    delete from SERVERLIST
    where SERVER_ID = 'F11'

    and I am getting this error message:

    Error starting at line 1 in command:
    delete from SERVERLIST
    where SERVER_ID = 'F11'
    Error report:
    SQL Error: ORA-04091: table APSOM.PROCESS_STATUS is mutating, trigger/function may not see it
    ORA-06512: at "APSOM.TD_SERVERLIST", line 9
    ORA-04088: error during execution of trigger 'APSOM.TD_SERVERLIST'
    04091. 00000 - "table %s.%s is mutating, trigger/function may not see it"
    *Cause: A trigger (or a user defined plsql function that is referenced in
    this statement) attempted to look at (or modify) a table that was
    in the middle of being modified by the statement which fired it.
    *Action: Rewrite the trigger (or function) so it does not read that table.

    I saw online that this sort of issue relates to deletions of records with datetime fields, but I was unclear as to how to resolve this issue. Any help would be greatly appreciated.

    Patrick Quinn
    Operations
    Turning Point Global Solutions
    Last edited by gikyo12; 09-18-12 at 11:51. Reason: Forgot to include autosignature

  2. #2
    Join Date
    Jun 2004
    Posts
    746
    Have you searched for an answer on this forum? There's 180 finds for "trigger mutating".
    90% of users' problems can be resolved by punching them - the other 10% by switching off their PCs.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,650
    you can avoid Mutating Trigger error by not doing SQL in a trigger against same table upon which trigger is based.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    There are no stupid questions, but there are a LOT of Inquisitive Idiots.

Posting Permissions

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