Trigger giving an error

I have a trigger defined as follows:
create or replace trigger TR_MY_TRIGGER after
delete or
update on member
begin
end;
At the end of the trigger I have a SELECT on the member table, the table on which this trigger is based. I get a mutating error: ORA-04091: table member is mutating
How can I get around this problem? I have tried to put the select in a procedure, but that does not work either. I have also tried to put pragma autonomous_transaction in the trigger, but to no avail.
Thanks
Edited by: user447219 on Nov 2, 2012 10:27 AM
Edited by: user447219 on Nov 2, 2012 10:28 AM

user447219 wrote:
At the end of the trigger I have a SELECT on the member table, the table on which this trigger is based. So when you select from the table do you know if you are getting the new or old values that are both present in a row level trigger? And which values do you want?
I get an error message: An error occured.ORA-20505| Error in DML| p_rowid=
You actually get a different error
http://docs.oracle.com/cd/E11882_01/server.112/e17766/e2100.htm#sthref1926
>
ORA-04091: table string.string is mutating, trigger/function may not see it
You are just hiding it and replacing it with that useless message to make troubleshooting and debug more difficult.
How can I get around this problem? I have tried to put the select in a procedure, but that does not work either. I have also tried to put pragma autonomous_transaction in the trigger, but to no avail.The mutating table error is like the safety catch on a gun that makes it go click when you aim it at your toes and pull the trigger. You should not work around it, it is trying to tell you what you are trying to do is not reliable. Autonomous transactions are not a fix for this.
You should read this and then find a different way to do whatever it is you need to do.
http://docs.oracle.com/cd/E11882_01/server.112/e25789/part_txn.htm#CHDJIGBH

Similar Messages

  • This trigger giving mutation error? any body can tell why?

    Hi All,
    Could any body tell me where is the problem in my trigger.
    my tables are.
    1) EMP :- emp_id,emp_movement_status
    2) EMPLOYEES_DAILY_MOVEMENT :- emp_id,transaction_time,transaction_remarks.
    if i delete a entry from transactions_table, it has to take latest remarks from the maximum record after deletion of the record, then update EMP table accordingly.
    trigger is:-
    CREATE OR REPLACE TRIGGER change_employee_status AFTER INSERT OR UPDATE OR DELETE ON
    employees_daily_movement FOR EACH ROW
    DECLARE
    local_remarks VARCHAR2(50);
    BEGIN
    IF DELETING THEN
    SELECT transaction_remarks INTO local_remarks FROM employees_daily_movement WHERE
         transaction_id = (SELECT MAX(transaction_id) FROM employees_daily_movement WHERE
         emp_id = :old.emp_id );
    /* here im expecting to take the TRANSACTION_REMARKS column value from employees_daily_movement after deleting the record which i wanted */
    UPDATE emp SET emp_movement_status = local_remarks WHERE emp_id = :old.emp_id;
    END IF;
    END;
    Thanks in advance

    Hi Mr Rao,
    You can handle muttating erros with following
    1. Database version is oracle 9i and above, you can over come this problem for ever by using pragma autonomous_transaction.
    2. Another way is, if you database version earlier to 9i then you can re-pharase this trigger by writting statement level trigger instead row level.
    Cheers!!
    Mahesh Ragineni

  • Using WebUtil Function giving an error

    I installed the WebUtil, i executed the demo(example which would have been in installation file which is running on my system) but now i want to open html file in my form using webutils function present in some remote system WEBUTIL_FILE_TRANSFER.URL_To_Client I have been created the form with one button & wrote an trigger when-button-pressed wrote the below means calling the below function which is giving an error
    WebUtil_file_transfer.URL_To_Client('www.somesite_filename.com','C:\CR');
    or
    WebUtil_file_transfer.URL_To_Client('C:\CR','www.somesite_filename.com');
    ERROR::'URL_TO_CLIENT' is not a procedure or is undefined
    Could u please help me & if u have any documents related to webutil please send those to me.My mail id is: [email protected]

    You need 3 arguments...
    FUNCTION URL_To_Client(    sourceURL         in VARCHAR2,
                                 clientDestination in VARCHAR2,
                                 fileSize          in PLS_INTEGER default 0) return BOOLEAN;
    webutil_file_transfer.url_to_client('some_url', 'c:\cf', null);------- snip from comments of webutil.pll --------------
       * URL_To_Client - pulls a file from the specified URL on any server and
       * sends it via http to the specified destination on the client
       * If you specify file size we can do a comparison after download to ensure
       * that the sizes match
       * Additionally if you specify withProgress and size you will get a progress
       * bar.
       * If you don't specify any size or if you specify default size, then webutil
       * will try to get the size of the url on its own for the purpose of showing
       * the progress bar.
       * Note that the Title, subtitle and message strings cannot contain the '|'
       * character
      FUNCTION URL_To_Client(    sourceURL         in VARCHAR2,
                                 clientDestination in VARCHAR2,
                                 fileSize          in PLS_INTEGER default 0) return BOOLEAN;
      FUNCTION URL_To_Client_With_Progress(
                                 sourceURL         in VARCHAR2,
                                 clientDestination in VARCHAR2,
                                 fileSize          in PLS_INTEGER default 0,
                                 progressTitle     in VARCHAR2,
                                 progressSubTitle  in VARCHAR2,
                                 progressMessage   in VARCHAR2) return BOOLEAN; 
    ----------------- End Snip ----------Message was edited by:
    Mark Reichman

  • I am trying to capture from Sony HDV 1080i VTR FCP giving an error of not able to initialize

    i am trying to capture from Sony HDV 1080i VTR FCP giving an error of not able to initialize. I am not able to capture the content in DV mode. i am using a Firewire 800 to 400 converter and a 6 pin firewire cable to connect to the SonyHDV VTR. Please suggest me how do i do this.

    The 800-400 converter plugs have proved a problem for this. What version of the software are you using. It sounds like an older version of FCP, if so you should ask your question on the Final Cut Studio forum.

  • Report giving runtime error

    hi,
    i HAD MADE A REPORET IN which i havce to display the bolck stock ,it is giving runtime error as i had added 1 more table,plzz help me out as it is really urgent to me. here is d code:-
    *& Report  ZDEMO_SMARTFORM_COPY
    REPORT  ZDEMO_SMARTFORM_COPY.
    TABLES: MCHB,MARA,T001W.
    DATA: BEGIN OF ITAB OCCURS 0,
          ITEMID LIKE MARD-MATNR,
          SPEME LIKE MARD-SPEME,
          WERKS LIKE MARD-SPEME,
          LGORT LIKE MARD-LGORT,
          NTGEW LIKE MARA-NTGEW,
          MEINS LIKE MARA-MEINS,
          GEWEI LIKE MARA-GEWEI,
          CHARG LIKE MCHB-CHARG,
          WTKG LIKE MARA-NTGEW,
          STOCK TYPE P LENGTH 10 DECIMALS 3,
          DESC LIKE MAKT-MAKTX,
          TOTWT LIKE MARD-SPEME,
          WT TYPE P LENGTH 12 DECIMALS 3,
          END OF ITAB.
         ITEMID LIKE MCHB-MATNR,
         CSPEM LIKE MCHB-CSPEM,
         CHARG LIKE MCHB-CHARG,
         WERKS LIKE MCHB-WERKS,
    *PARAMETERS : PLANT LIKE MCHB-WERKS OBLIGATORY.
    PARAMETERS : PLANT LIKE MARD-WERKS OBLIGATORY.
    DATA : DESC LIKE MAKT-MAKTX.
      SELECT AMATNR ASPEME AWERKS ALGORT BNTGEW BMEINS BGEWEI CCHARG FROM MARD AS A
        INNER JOIN MARA AS B ON BMATNR = AMATNR
          INNER JOIN MCHB AS C ON CMATNR = AMATNR
            INTO TABLE ITAB WHERE AWERKS = PLANT AND ASPEME > 0.
    SELECT AMATNR ACSPEM ACHARG AWERKS  BNTGEW BMEINS B~GEWEI FROM MCHB AS A
       INNER JOIN MARA AS B ON BMATNR = AMATNR
         INTO TABLE ITAB WHERE AWERKS = PLANT AND ACSPEM > 0.
    WRITE: / 'ITEMID           DESCRIPTION                              STOCK.QTY  BATCH NO.           NETWT          TOTAL.WEIGHT '.
    ULINE.
    LOOP AT ITAB.
          IF ITAB-NTGEW <> 0 .
            CALL FUNCTION 'ZGET_ITEM_WEIGHT'
             EXPORTING
               P_BUID         = ITAB-WERKS
               P_ITEMID       = ITAB-ITEMID
               P_QTY          = ITAB-NTGEW
               P_UOM          = ITAB-GEWEI
               P_UOM1         = 'KG'
             IMPORTING
               P_RETVAL       = ITAB-WTKG.
          ENDIF.
       CONVERTING ITEM QTY IN KG
          ITAB-WT = ITAB-STOCK.
          IF ITAB-MEINS = 'G'.
            ITAB-WT = ITAB-STOCK / 1000000.
          ELSEIF ITAB-MEINS = 'KG'.
            ITAB-WT = ITAB-STOCK / 1000.
          ELSEIF ITAB-MEINS = 'TO'.
            ITAB-WT = ITAB-STOCK * ITAB-WTKG / 1000.
         ENDIF.
       ITAB-TOTWT = ITAB-WTKG * ITAB-CSPEM.
       ITAB-TOTWT = ITAB-WTKG * ITAB-SPEME.
       SELECT SINGLE MAKTX FROM MAKT INTO DESC WHERE MATNR = ITAB-ITEMID.
         WRITE:/ ITAB-ITEMID,15 DESC,50 ITAB-SPEME,ITAB-CHARG,ITAB-WTKG,ITAB-TOTWT.
       MODIFY ITAB.
       ENDLOOP.

    HI,
    i had tried to ftech data from mard and it isgiving runtime error. dis is the code:-
    TABLES: MCHB,MARA,MARD.
    DATA: BEGIN OF ITAB OCCURS 0,
          MATNR LIKE MARD-MATNR,
          SPEME LIKE MARD-SPEME,
          WERKS LIKE MARD-SPEME,
          LGORT LIKE MARD-LGORT,
          END OF ITAB.
          SELECT MATNR SPEME WERKS LGORT FROM MARD INTO CORRESPONDING FIELDS OF TABLE ITAB.
          LOOP AT ITAB.
          WRITE:/ ITAB-MATNR,ITAB-SPEME,ITAB-WERKS,ITAB-LGORT.
          ENDLOOP.

  • Hi I am using an iphone 4 and its was working fine.  Presently its giving browsing error.  Whenever I am trying to browse internet by using safari or any other browser it retruns with "server not responding" Can somebody give me a solution for this ?

    Hi I am using an iphone 4 and its was working fine.  Presently its giving browsing error.  Whenever I am trying to browse internet by using safari or any other browser it retruns with an error message "server not responding" Even the same thing is happening with youtube also. The worst part is am able to check my mails, able to chat and so on... only thing not able to browse through the browser.  I have tried restore option also.  This is happening with both Wlan and Data con. too
    Please help...

    I do not really know much about this kind of problem, but i may be your internet connection.
    If you are on your own #G network then:
    Go to Settings > then enable "Airplane Mode". Count to 10 and then disable it.
    Then wait patiently until you get a good connection and then try again.
    If you are on a nearby Wi-Fi connection then:
    Go to Settings > Wi-Fi > then disable then enable after counting to 10. Make sure that you are connected and then try again.
    If all else fails, then you need to contact your provider for assistance.
    Sprint:888-211-4727
    AT&T:?
    Verizon:?

  • I forgot my passcode for the ipad and i can't connect to iTunes because it keeps giving me error message that i have to unlcok the ipad first... any advice on how to restore the ipad or unlock it?

    i forgot my passcode for the ipad and i can't connect to iTunes because it keeps giving me error message that i have to unlcok the ipad first... any advice on how to restore the ipad or unlock it?

    You have to restore the device within iTunes. You want to use the same computer that you always sync with so that you can restore your app data and settings. You can restore with any other computer, but you will lose everything on the iPad.
    This will tell you how to restore
    http://support.apple.com/kb/HT1414
    You will probably need to use recovery mode
    http://support.apple.com/kb/ht4097

  • TS2529 I am unable to backup my iphone 5 iOS 6.0.1 (connected directly to laptop USB) with my itunes 11 for Win 7 64bits. The process starts and fails to complete giving the error: itunes could not complete backup of iphone because iphone disconnected.

    I am unable to backup my iphone 5 iOS 6.0.1 (connected directly to laptop USB) with my itunes 11 for Win 7 64bits. The process starts and fails to complete giving the error: itunes could not complete backup of iphone because iphone disconnected.
    I have restarted the PC, the iphone, changed the lightining cable and nothign resolves it: backup never completes.

    Hi, I disabled the antivirus and the firewall. Same result
    I even deleted the backup folder inside C:\Users\...\Apple Computer\MobileSync\Backup to eliminate any corruption in the old backup files.
    Nothing changed: Session either times out or i get the same error message: itunes could not back up iphone because iphone disconnected. It always happens during step 3 out of 4 which is "transfering purchased apps from iphone to PC" and comes after step 2 which is backup.
    My iphone 5 is not jailbroken, and is a factory unlocked phone.
    Any other suggestion?
    Pls help

  • Steve Jobs obviously was "the man" because every update or install now gives me problems... i can no longer download anything to my iphone.. giving me errors of "cannot install at this time" and i get an error installing itunes on my other laptop... wth?!

    Steve Jobs obviously was "the man" because every update or install now gives me problems... i can no longer download anything to my iphone.. giving me errors of "cannot install at this time" and i get an error installing itunes on my other laptop... wth is going on!??!
    ok so the download problem with my iphone.. what could be the cause of that? ive restarted and deleted the "undownloaded app" over 10 times already. and restarted the iphone 10 times... next thing i know i cant install itunes on my laptop.... geez man..
    obviously there is a fix which someone will help... but why should i have to go through all that crap to install a so called uncomplicated software... when you think about it this really shouldnt even be an issue.
    normally if the thing dosent work. normally with most programs you just uninstall the uncompleted software and just reinstall and everything is usually good to go.. help!

    ive never had any problems with ap[ple products in the past... this is a first and a stupid problem if you ask me

  • I installed itunes 10.5 in my PC to sync with my ipod touch 4G but it's giving me error that itunes could not connect to itnues store.Make sure network connection is active and try again...I'm connected to internet though, please help!

    I installed itunes 10.5 in my PC to sync with my ipod touch $G but it's giving me error message that itunes could not connect to itunes store..."make sure network is active and try again." I'm connected to internet though so I don't understand please help!

    Close your iTunes,
    Go to command Prompt -
    (Win 7/Vista) - START/ALL PROGRAMS/ACCESSORIES, right mouse click "Command Prompt", choose "Run as Administrator".
    (Win XP SP2 &amp; above) - START/ALL PROGRAMS/ACCESSORIES/Command Prompt
    In the "Command Prompt" screen, type in
    netsh winsock reset
    Hit "ENTER" key
    Restart your computer.
    If you do get a prompt after restart windows to remap LSP, just click NO.
    Now launch your iTunes and see if it is working now.
    If you are still having these type of problems after trying the winsock reset, refer to this article to identify which software in your system is inserting LSP:
    iTunes 10.5 for Windows: May see performance issues and blank iTunes Store
    http://support.apple.com/kb/TS4123?viewlocale=en_US

  • I cant update ,y ipod touch 4 , i tried everything but it keep giving me error 3194, i cant update ,y ipod touch 4 , i tried everything but it keep giving me error 3194

    i cant update ,y ipod touch 4 , i tried everything but it keep giving me error 3194, i cant update ,y ipod touch 4 , i tried everything but it keep giving me error 3194

    Did you try the actions specified here:
    - iTunes: Specific update-and-restore error messages and advanced troubleshooting
    - 3194-How do I reset the hosts file back to the default?
    - http://support.apple.com/kb/ts1275
    Saying "i tried everything " provides us with no information as to what you arelady tried?

  • I was updating my ipad 2 and got it disconnected and its not responding,giving a blank screen with apple logo. when i connect it to itunes then it is giving an error that enter your passcode but the screen is blank how can enter my passcode?

    I was updating my ipad 2 and got it disconnected and its not responding,giving a blank screen with apple logo. when i connect it to itunes then it is giving an error that enter your passcode but the screen is blank how can enter my passcode?

    What to Do When Your iPad Won't Turn On
    http://ipad.about.com/od/iPad_Troubleshooting/ss/What-To-Do-When-Your-Ipad-Wo-No t-Turn-On.htm
    iOS: Not responding or does not turn on
    http://support.apple.com/kb/TS3281
    iPad Frozen? How to Force Quit an App, Reset or Restart Your iPad
    http://ipadacademy.com/2010/11/ipad-frozen-how-to-force-quit-an-app-reset-or-res tart-your-ipad
    iPad: Basic troubleshooting
    http://support.apple.com/kb/TS3274
    iOS: Resolving update and restore alert messages
    http://support.apple.com/kb/TS1275
    iPad: Unable to update or restore
    http://support.apple.com/kb/ht4097
     Cheers, Tom

  • I could not transfer photos from iphone to macbook through iphoto. It is giving an error " could not be imported, file is in unrecognized format"

    I could not transfer photos from iphone to macbook through iphoto. It is giving an error " could not be imported, file is in unrecognized format"

    Did you look in iTunes?

  • My canon MP240 is giving me error code 5200, what do i do?

    my canon MP240 is giving me error code 5200, what do i do? there was a paper jam but i took care of it and im still getting the message. do i need a new printer?

    Hi bonzaiburger,
    If one or more if the ink cartridges in your printer are not low or out of ink, and resetting the printer does not resolve the error, the printer will require servicing to resolve the issue.  Please call or email us at one of the methods on the Contact Us page to obtain your servicing options.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • Use Of "#EC CI_EXECSQL in ABAP with EXEC SQL. Statement giving Syntax Error

    Dear Gurus,
    I have encountered an issue while trying to remove warning for using Native SQL statement using pseudo comment "#EC CI_EXECSQL
    The thing is like this -- i have used follwing native sql command in abap.
    EXEC SQL.
        CONNECT TO 'SURROUND_DB'
      ENDEXEC.
    Now when i am checking this code in code inspector it is showing a warning with information below
    CA CL_CI_TEST_CRITICAL_STATEMENTS0006
    Code Inspector
    Critical Statements
    Use of Native SQL
    Authorization checks cannot be appropriately run using EXEC SQL and should be carried out at program level.
    The message can be hidden using the pseudo-comment "#EC CI_EXECSQL
    Use of exceptin handling section for that warning showing me to use :
    The message can be hidden using pseudo
    comment      "#EC CI_EXECSQL
    Now when I am using "#EC CI_EXECSQL in the abap like below :
    EXEC SQL. "#EC CI_EXECSQL
        CONNECT TO 'SURROUND_DB'
      ENDEXEC.
    It is giving syntax error
    The text literal ""#EC CI_EXECSQL        " is longer than 255
    characters.Check whether it ends correctly.
    Please provide the guideline to resolve this issue.
    Thanks & regards
    Saifur Rahaman.

    Hi Saifur,
    You can remove the warning using the following syntax:
    EXEC "#EC CI_EXECSQL
      SQL.
        CONNECT TO 'SURROUND_DB'
      ENDEXEC.
    At least, it worked fine for me when using OPEN CURSOR, SELECT, FETCH and so on statements.
    The way to use the pseudo comment is not very intuitive, but at least for my examples worked fine.
    I hope this may help you.
    Best regards,
    Edgardo G. König

Maybe you are looking for