Triggers

Discussions

General J2EE: Triggers

  1. Triggers (1 messages)

    Respected Sir,
    I have a doubt in triggers..
    Im having a table FIXED_DEPOSIT that has following fields:
    FD_NO, Debit_ACNO, DURATION, FD_TYPE, INT_PERIOD, PAYMENT_MODE, Credit_ACNO, DD, RQSTD_DATE, MATURITY_DATE, AMOUNT

    and rqstd_date is the sysdate..

    i insert all the fields except the sysdate and maturity_date.
    sysdate is made default.

    To insert the maturitydate,i used the following trigger.,

    CREATE OR REPLACE TRIGGER update_mdate
    AFTER INSERT OR UPDATE ON FIXED_DEPOSIT
    FOR EACH ROW
    BEGIN
    UPDATE FIXED_DEPOSIT SET maturity_date=(SELECT ADD_MONTHS(sysdate,duration)+1 FROM dual);
    END;
    /

    I dont know whether it is correct or not ,but it is not showing any error when compiling,
    but when executing it is showing the following error,

    table fixed_deposit is mutating,trigger/function may not see it
    error during the execution of trigger 'update_mdate'


    please help me to get rid of this error.

    thanking you,
    S.Kokila

    Threaded Messages (1)

  2. Triggers[ Go to top ]

    Mutating basically means that it is trying to enter a record into that column more thatn once. It could be some other trigger or a side effect of the trigger that you wrote to insert/update. Check your constraints for that field and make sure that you are not defaulting that column as well.