Mutating error in code..help required?

hi All,
I have applied trigger on emp as below....
CREATE OR REPLACE TRIGGER trig_emp
AFTER INSERT OR UPDATE OR DELETE
ON EMP
FOR EACH ROW
DECLARE
     PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
     IF INSERTING THEN
                    PKG_PC.TRIG_PROC_INS;
     ELSIF DELETING THEN
          dbms_output.PUT_LINE('hye..deleting');
     ELSIF UPDATING THEN
                    PKG_PC.TRIG_PROC_UPD;
     END IF;
EXCEPTION
          WHEN OTHERS THEN
               dbms_output.PUT_LINE('exception occured'||SUBSTR(SQLERRM,1,100));
END;
pkg_pc code is as below.....
CREATE OR REPLACE PACKAGE PKG_PC
AS
     PROCEDURE TRIG_PROC_INS ;
     PROCEDURE TRIG_PROC_UPD ;
END;
CREATE OR REPLACE PACKAGE BODY PKG_PC
AS
     PROCEDURE TRIG_PROC_INS
     AS
          curdate date;
     BEGIN
          SELECT sysdate INTO CURDATE
          FROM dual;
          -- EXECUTE IMMEDIATE 'TRUNCATE TABLE EMP_LOG';
          INSERT INTO EMP_LOG(LOG_STEP, LOG_DATE)
          VALUES('INSERT',SYSDATE );
--          SELECT E.* ,'INSERT',SYSDATE          FROM EMP E;
          dbms_output.put_line('PROCEDURE called for inserting from trigger at-'||CURDATE);
     END;
     PROCEDURE TRIG_PROC_UPD
     AS
          curdate date;
          -- PRAGMA AUTONOMOUS_TRANSACTION;
     BEGIN
          INSERT INTO EMP_LOG --(LOG_STEP, LOG_DATE)
          -- VALUES('UPDATE',SYSDATE );
          SELECT E.* ,'UPDATE' ,SYSDATE     FROM EMP E;
          SELECT sysdate INTO CURDATE
          FROM dual;
          dbms_output.put_line('PROCEDURE called for UPDATING from trigger at-'||CURDATE);
     END;
END;
kindly direct why i am getting msg as below when I am running update stmnt...
UPDATE EMP
SET SAL=5000
WHERE EMPNO=1;
o/p msg -
PROCEDURE called for UPDATING from trigger at-07-SEP-10
exception occuredORA-06519: active autonomous transaction detected and rolled back
rgds,
pc

hi
PROCEDURE TRIG_PROC_UPD
AS
curdate date;
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO EMP_LOG (LOG_STEP, LOG_DATE)
VALUES('UPDATE',SYSDATE );
--SELECT E.* ,'UPDATE' ,SYSDATE FROM EMP E;
SELECT sysdate INTO CURDATE
FROM dual;
dbms_output.put_line('PROCEDURE called for UPDATING from trigger at-'||CURDATE);
commit; /**Always you should End your Transaction in Autonomous Block ***/
END;Regards,
Achyut

Similar Messages

  • HT201209 When I try to redeem it says error invalid code help me please.

    When I try to redeem it says error invalid code help me please.

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact
    Note: iTunes Gift Cards are only Valid in Country of issue

  • When i try to boot the time machine it gives me a error-43 code help

    When trying to boot up time machine on my imac desktop i get a error -43 code could someone help

    Without proper system info and other technical details nobody can tell you anything. chances are you may need to run the cleaner tool and reinstall everything from scratch.
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    Mylenium

  • Pl/sql  code  help required

    i have 3 string like below
    string1  varchar2(3000) := ' fonction code=''33'' and the limit for the subfunction is 300. it may have function_code=''100'' ) ) ) )';
    string2  varchar2(2000):='function_code=''100''';
    string3  varchar2(3000);requirement is
    if i found string2 in string1 preceded by four brackets ,example function_code=''100'' ) ) ) )' then
    i have replace to replace the 4th bracket with
    function code is null  )the string1 now will be
    ' fonction code=''33'' and the limit for the subfunction is 300. it may have function_code=''100'' ) ) ) function code is null  )Pls help
    NOte: bracket may or may not have spaces between them
    S

    SQL> declare
      2  string1  varchar2(3000) := 'AND NOT  (     (       (   FUNCTION_CODE = ''88''  )  OR  (   FUNCTION_CODE = ''21''  )  OR  (   FUNCTION_CODE = ''51'' )  OR  (   FUNCTION_CODE = ''85'' )  )  )  )' ;
      3  string2  varchar2(2000):='FUNCTION_CODE = ''85''';
      4  string3  varchar2(3000);
      5  begin
      6  string3 :=regexp_replace(string1,'^(.*)('||string2||')(([[:blank:]]?\)[[:blank:]]?){3})([[:blank:]]?\))(.*)$','\1\2\3function code is null\4\5');
      7  dbms_output.put_line(string3);
      8  end;
      9  /
    AND NOT  (  (  (   FUNCTION_CODE = '88'  )  OR  (   FUNCTION_CODE = '21'  )  OR  (   FUNCTION_CODE = '51' )  OR  (
    FUNCTION_CODE = '85' )  )  ) function code is null )  )
    PL/SQL procedure successfully completed.Best regards
    Maxim

  • Java inheritance and interface code help required

    please help me I need your 30 mins only,,, working on assignment and I am trying to understand interface and inheritance might not need even 30 mins, please add me on skype *[deleted by moderator]*
    Or add me on
    yahoo msgr *[deleted by moderator]*
    waiting for your help.
    I have no single person friend or I can ask help from who knows java or programming. pretty much want to learn need a friend who can guide me in java.
    unfortunately have to submit assignment tomorrow.
    Thank you in advance for your time and consideration.
    Akee
    *Edited by moderator: EJP on 10/11/2012 10:38: removed your private contact details. This is a public forum, not a personal help desk. Ask your questions here or not at all.*

    Hi,
    there are lot of thread alredy posted please serach
    check following link
    http://help.sap.com/saphelp_nw04/helpdata/en/ce/1d753cab14a909e10000000a11405a/frameset.htm
    XSLT Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
    Java Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
    Links of blogs on java mapping...
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
    blog
    /people/sap.user72/blog/2005/03/15/using-xslt-mapping-in-a-ccbpm-scenario
    /people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping(file to xslt mapping)
    /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners(xslt with java enhancement function)
    Regards,
    Amit

  • User exit code -  help required

    Hi Experts,
    I need to write a user exit for the field Posting level in the query. The logic is ,when posting level is either 10 or 20 for an ITEM then Key figure "Period value GC" should be divided by two and the result shouls be stored in the same Key figure.
    Technical names of the fields are as follows:
    Posting Level - 0cs_plevel . We have created a user exit variable ZBSUSER.
    Item - 0ITEM
    Period Value GC - 0cs_per_gc.
    Please let me know  the code to be written in CMOD to achieve the above result.
    Thanks,
    Kavitha Jagannath

    Hi,
    I need to write a user exit for the field Posting level in the query. The logic is ,when posting level is either 10 or 20 for an ITEM then Key figure "Period value GC" should be divided by two and the result shouls be stored in the same Key figure.
    You can do it in report it self you don't need EXIT CODE.
    Steps:
    1. Create a RKF and restrict (Include)ITEM = 10 and 20 &  drag and dropn Period value GC   " RKF -1
    2. Create another RKF and EXCLUDE ITEM = 10 and 20 &  drag and dropn Period value GC.  " RKF -2
    3. In Columns display both and create Formula-1 and divide RKF-1 with 2.
    4. Create a Formula and add Formula-1 and RKF -2  
    5. Hide unwanted calculations
    Your problem is resloved.
    Thanks
    Reddy
    Edited by: Surendra Reddy on Dec 14, 2009 2:25 PM

  • Mutating error in my trigger code

    Hi,
    Could anyone please help me out to fix the mutating error:
    I have 2 tables z_errorpayment and z_errorcorrected.
    If the status=2 in z_errorpayment table then a row has to be inserted in z_errorcorrected table and the same row has to be deleted from the 1st table i.e z_errorpayment.As it is retriving from the same table and deleting the same table am getting mutating error.
    Below is the code.
    CREATE OR REPLACE TRIGGER row_trigger
    AFTER UPDATE
    ON z_errorpayment
    FOR EACH ROW
    WHEN (NEW.status = 2)
    BEGIN
    INSERT INTO z_errorcorrected
    (mtnl_error_payment_id, file_name, entry_date,
    centre_code, service_code, instrument_flag,
    instrument_no, subs_no, instrument_dt,
    payment_mode, payment_dt, surchrg,
    telephone_no, cheque_number, cheque_dt,
    bank_code, pay_amount, receipt_no,
    terminal_id, crtn_by, crtn_dt, remarks,
    status, external_trans_id, transfer_date,
    gl_uploaded_ind_code, task_queue_id,
    user_name, old_payment_id, new_payment_id,
    payment_type
    VALUES (:NEW.mtnl_error_payment_id, :NEW.file_name, :NEW.entry_date,
    :NEW.centre_code, :NEW.service_code, :NEW.instrument_flag,
    :NEW.instrument_no, :NEW.subs_no, :NEW.instrument_dt,
    :NEW.payment_mode, :NEW.payment_dt, :NEW.surchrg,
    :NEW.telephone_no, :NEW.cheque_number, :NEW.cheque_dt,
    :NEW.bank_code, :NEW.pay_amount, :NEW.receipt_no,
    :NEW.terminal_id, :NEW.crtn_by, :NEW.crtn_dt, :NEW.remarks,
    :NEW.status, :NEW.external_trans_id, :NEW.transfer_date,
    :NEW.gl_uploaded_ind_code, :NEW.task_queue_id,
    :NEW.user_name, :NEW.old_payment_id, :NEW.new_payment_id,
    :NEW.payment_type
    DELETE FROM z_errorpayment
    WHERE new_payment_id = :NEW.new_payment_id;
    END;
    so I thought of using a view inorder to get rid of the mutating error.
    But donno how to code it.
    could anyone please help me out.
    Regards,
    Rupa

    By using a view i wrote the below code:
    CREATE OR REPLACE TRIGGER row_trigger
    INSTEAD OF UPDATE
    ON Z_ErrorView
    FOR EACH ROW
    DECLARE
    X INTEGER;
    BEGIN
    SELECT STATUS into X FROM z_errorpayment WHERE new_payment_id = :NEW.new_payment_id;
    IF X=2 THEN
    INSERT INTO z_errorcorrected
    (mtnl_error_payment_id, file_name, entry_date,
    centre_code, service_code, instrument_flag,
    instrument_no, subs_no, instrument_dt,
    payment_mode, payment_dt, surchrg,
    telephone_no, cheque_number, cheque_dt,
    bank_code, pay_amount, receipt_no,
    terminal_id, crtn_by, crtn_dt, remarks,
    status, external_trans_id, transfer_date,
    gl_uploaded_ind_code, task_queue_id,
    user_name, old_payment_id, new_payment_id,
    payment_type
    VALUES (:NEW.mtnl_error_payment_id, :NEW.file_name, :NEW.entry_date,
    :NEW.centre_code, :NEW.service_code, :NEW.instrument_flag,
    :NEW.instrument_no, :NEW.subs_no, :NEW.instrument_dt,
    :NEW.payment_mode, :NEW.payment_dt, :NEW.surchrg,
    :NEW.telephone_no, :NEW.cheque_number, :NEW.cheque_dt,
    :NEW.bank_code, :NEW.pay_amount, :NEW.receipt_no,
    :NEW.terminal_id, :NEW.crtn_by, :NEW.crtn_dt, :NEW.remarks,
    :NEW.status, :NEW.external_trans_id, :NEW.transfer_date,
    :NEW.gl_uploaded_ind_code, :NEW.task_queue_id,
    :NEW.user_name, :NEW.old_payment_id, :NEW.new_payment_id,
    :NEW.payment_type
         END IF;
    DELETE FROM z_errorpayment
    WHERE new_payment_id = :NEW.new_payment_id;
    END;

  • Help with Mutating Error / Trigger / APEX_MAIL.SEND

    Hello:
    I am trying to get the apex_mail.send function working when a user submits a new record. I've taken the code from the canned Issue Tracker application code and tried to retrofit it to my tables. However I keep receiving a mutating error on line 11 (line 11 bolded below):
    -- Create a trigger that will send notification after
    -- the submission of each new idea on the IDEAS table.
    create or replace trigger IDEAS_EMAIL
    AFTER
    insert or update on IDEAS
    for each row
    begin
    IF (INSERTING AND :new.manager_name IS NOT NULL)
    OR
    (UPDATING AND (:old.manager_name IS NULL OR :new.manager_name != :old.manager_name) AND :new.manager_name IS NOT NULL) THEN
    FOR c1 IN
    (SELECT fname, lname, email
    FROM ideas_users
    WHERE fname||' '||lname = :new.manager_name)
    LOOP
    IF c1.email IS NOT NULL THEN
    FOR c2 IN
    (SELECT MANAGER_NAME, FULL_TEXT, SUMMARY, ID, SUBMITTED_BY, SUB_DATE
    FROM IDEAS
    WHERE ID = :new.ID)
    LOOP
    APEX_MAIL.SEND(
    p_to => c1.email,
    p_from => c1.email,
    p_body =>
    'This is a test message. ' ||chr(10)||
    p_subj => 'test email subject');
    END LOOP;
    END IF;
    END LOOP;
    END IF;
    end;
    I've also tried setting the following line to the primary key field in the user table and inserting that value into the main table but I still get the same error message.
    WHERE fname||' '||lname = :new.manager_name)
    Thanks in advance for any help.

    Let me get this straight..
    You are inserting a row into a table, and when you insert the row, you are going to send an e-mail t o the manager who owns this row. In the data you are inserting, is the e-mail address of the manager, right?
    David has provided the answer for you.. Use the :NEW.Email value instead of creating a cursor and all that.. Unless you have a need to e-mail multiple people of the record insert..
    Thank you,
    Tony Miller
    Webster, TX
    On the road of life...There are 'windshields', and there are 'bugs'
    (splat!)
    "Squeegees Wanted"

  • I tried to sync my Macbook Pro photos in iPhoto with my iPod Touch.  I have done this numerous times, but today I got an error message saying the required file cannot be found.  At the same time all of my photos on my iPod vanished.  Can anyone help me?

    I tried to sync my Macbook Pro photos in iPhoto with my iPod Touch.  I have done this numerous times, but today I got an error message saying the required file cannot be found.  At the same time all of my photos on my iPod vanished.  Can anyone help me?

    Try deleting the photo cache from your computer and then re-try the photo sync - the location of the cache, and how to delete it, is on this page http://support.apple.com/kb/TS1314

  • Adobe Premiere CC Trial Version "Sorry, a serious error has occurred that requires Adobe Premiere Pro to shut down." PLEASE HELP!

    Every time I open any project in Adobe Premiere CC Trial Version, I get the message "Sorry, a serious error has occurred that requires Adobe Premiere Pro to shut down. We will try to save your project." I can't edit at all and am totally stuck. Please help!
    It's terrible that this is happening on the trial version as it's making me want to go straight back to FCP! Also - I've tried switching external hard drive and that also doesn't work.
    Thank you!

    So, opening a new project works?

  • I have a MacBook Pro, Matshita UJ-857E while recording music my drive reported an error: Sense Key=HARDWARE ERROR Sense Code=0x03,0x01 I have no idea what this means, and now my cd burner/player won't work. can someone help me fix this problem?

    Please Help me. I am having problems with my MATSHITA UJ-857E DVD-R burner/writer. I burned 4 cd's and then it stopped working.
    I can select my songs, and then it asks for a blank disc. It starts preparing to write the disc,then it says,"
    The drive reported an error: Sense Key= HARDWARE ERROR Sense Code= 0x09,0x01 TRACKING SERVO FAILURE.
    Can anyone give me some advice on how to fix it or what this means because I have no idea what it is talking about or how to begin to fix the problem?

    tanyafrombakersfield wrote:
    It starts preparing to write the disc,then it says,"
    The drive reported an error: Sense Key= HARDWARE ERROR Sense Code= 0x09,0x01 TRACKING SERVO FAILURE.
    This is an error reported by the optical drive's firmware. The tracking servo is the servomechanism which guides the laser pickup along the track on the optical disc. The error means that the servo couldn't do its job within the programmed parameters. What it doesn't say is why.
    You have to be very precise as to when this error occurs. If it occurs as you wrote, while it "starts preparing to write the disc", and not when it has actually began to burn, then it's likely that the drive has gone bad and needs to be replaced.
    There are other possibilities, so you should check them, but they would be more likely if the error occurred after the drive began to write. OrangeMarlin has suggested two options -- try a different brand of CD or DVD, and try cleaning the lens.

  • I tunes 11 will not let me sync my I pod nano... keep getting error meessage:  the software required for this I pod was not installed correctly... I have tried to reinstall 6 times Dumped everything i tunes related no luck help!

    I recently updated to Itunes 11 and now no sync... get error message: The software required for this I pod was not installed correctly. Please reinstall Itunes to install the required software.  I backed up all music and deleted all related itunes items and still get this error after 6 attempts to reload itunes... i give up please help

    I recently updated to Itunes 11 and now no sync... get error message: The software required for this I pod was not installed correctly. Please reinstall Itunes to install the required software.  I backed up all music and deleted all related itunes items and still get this error after 6 attempts to reload itunes... i give up please help

  • A SMALL EXAMPLE CODE FOR MUTATING ERROR

    create or replace trigger TRG_T1
    before insert on T1
    begin
    insert into T1 values(2);
    end;
    IF I TRY TO INSERT INTO T1 TABLE I GET A MUTATING ERROR HOW CAN I SOLVE??????

    joealexander wrote:
    create or replace trigger TRG_T1
    before insert on T1
    begin
    insert into T1 values(2);
    end;
    IF I TRY TO INSERT INTO T1 TABLE I GET A MUTATING ERROR HOW CAN I SOLVE??????
    No, you do NOT get a mutating table error. You get this:
    orcl112> create table t1(c1 number);
    Table created.
    Elapsed: 00:00:00.03
    orcl112> create or replace trigger TRG_T1
      2
      3  before insert on T1
      4
      5  begin
      6
      7  insert into T1 values(2);
      8
      9  end;
    10
    11  /
    Trigger created.
    Elapsed: 00:00:00.04
    orcl112> insert into t1 values (1);
    insert into t1 values (1)
    ERROR at line 1:
    ORA-00036: maximum number of recursive SQL levels (50) exceeded
    ORA-06512: at "SCOTT.TRG_T1", line 3
    ORA-04088: error during execution of trigger 'SCOTT.TRG_T1'
    ORA-06512: at "SCOTT.TRG_T1", line 3
    ORA-04088: error during execution of trigger 'SCOTT.TRG_T1'
    ORA-06512: at "SCOTT.TRG_T1", line 3
    ORA-04088: error during execution of trigger 'SCOTT.TRG_T1'
    ORA-06512: at "SCOTT.TRG_T1", line 3
    ORA-04088: error during execution of trigger 'SCOTT.TRG_T1'
    ORA-06512: at "SCOTT.TRG_T1", line 3
    ORA-04088: error during execution of trigger 'SCOTT.TRG_T1'
    You are the second person today who has claimed to have seen this error and posted code that did not raise it. What is going on?

  • I/O Error: Result Code=-36  HELP!!!

    Anyone got any idea what this is about? The problem in a nutshell is as follows...
    I'm running Logic 7.2.3 on a G5 (PowerPC version) with a dedicated, built in 250gig HD for audio. Over the last week I've suddenly become aware that everything I thought was being saved to this HD is impossible to access anymore and I get the above error code coming up each time.
    However, anything recorded to this HD prior to the last week still opens fine with no issues at all.
    Tell me I'm being stupid and have done something ridiculous, please!!! There's a whole lot of work down the drain if that's not the case.
    Any help you can offer would be greatly appreciated.
    Thanks.

    I have never experienced that error, but I Googled "I/O Error: Result Code=-36" and found this...
    It really has nothing to do with Logic. It is a Mac OSX error being passed on
    by Logic. It has to do with not being able to write to the drive. You can
    get this error in Logic if your recording drive is too full, is too
    fragmented, or the directory is messed up.
    Some things you can do to solve the problem are: Make sure you are recording
    to a drive other then the system drive, make sure you have plenty of free
    space on the recording drive, repair permissions, defrag the recording
    drive, or run a disk utility like Disk Warrior to check and repair directory
    issues.
    Hans
    here is the link to that ...
    http://logic-users.org/forums/LUG/thread/81375

  • Error Result Code -48?  Help...won't record!

    I use G-band for basic VO recording in my home studio into my Powerbook. I run a simple stereo line-in and record to a completely basic stereo track. Nothing fancy. This has worked flawlessly for months.
    Just now, in mid-session, I click on the red Record button and I get this message: Error Result Code -48. It doesn't begin to record at all. The message is immediate, and it won't record.
    This program is pretty vital to my business. Can anyone help me figure this out?? I have restarted the program, shutdown and restarted the Powerbook. No luck.
    Any help?!
    ge

    You could try some web searches. I just know some of them because I've run into them while programming, and have some notes scattered about here and there for some of the less common ones, but not all of them.

Maybe you are looking for