DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: ORA-04091: table is mutating, trigger/function may not see it error

Threaded View

  1. #5
    Join Date
    Mar 2005
    Posts
    143
    I had to make an adjustment to the trigger. they don't want the trigger to update the Office4 field if a payment was made, they want it to update the field if the entire balance was paid. The balance value is not stored in the Patient table. here is my new trigger:
    CREATE OR REPLACE TRIGGER AXIUM."RMVBALTRG"
    BEFORE UPDATE OF
    "LastPaymentAmount"
    ON "PATIENT"
    REFERENCING NEW AS NEW
    FOR EACH ROW
    DECLARE
    v_bal NUMBER(10);
    BEGIN
    SELECT "AmountDue" into v_bal FROM PTBAL where "Patient"=:new."Patient" and "Batch"=(SELECT MAX("Batch") FROM ptbalbat);
    IF (:NEW."LastPaymentAmount" = v_bal) THEN
    :NEW."Office4" := ' ';
    END IF;
    END;
    /

    the trigger builds fine. if I run this statement through toad it executes the trigger and does what I want.
    update PATIENT set "LastPmtDate"='10-FEB-2010' , "LastPaymentAmount"=735 where "Patient"=112826
    this patient has a $735 balance so it updared the office4 field. however when I go through the application and apply a payment i get this error:

    Error - SQL execution error, ORA-01403: no data found
    ORA-06512: at "AXIUM.RMVBALTRG", line 4
    ORA-04088: error during execution of trigger 'AXIUM.RMVBALTRG'

    Last SQL: UPDATE PATIENT SET "LastPmtDate" = :1 , "LastPaymentAmount" = :2 WHERE PATIENT."...

    Can anyone help me out here? Please
    Last edited by jayjabour; 02-16-2010 at 04:59 PM.

Posting Permissions

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


Click Here to Expand Forum to Full Width