Trigger with mutant error even using Pragma Autonomous_transaction;

Asked

Viewed 28 times

0

I’m a beginner and I’m having trouble solving a simple problem:

I created Trigger below:

AFTER INSERT OR UPDATE ON CARRO FOR EACH ROW
    DECLARE
        Pragma Autonomous_Transaction;
        V_REFERENCIA           INT;
    
    BEGIN
        SELECT   COR||MODELO
        INTO    V_REFERENCIA 
        FROM TGFPRO
        WHERE  PLACA = :NEW.PLACA ;
        
        UPDATE CARRO SET REFERENCIA = V_REFERENCIA 
        WHERE PLACA = :NEW.PLACA ;
    END;

In this Rigger I have a table and in it I need to concatenate the values to generate a new field, but Oracle is accusing that my Rigger is mutant and does not perform. This field should be updated whenever there is a change in color or in the model, updating the field reference.

I have tried some tutorials and is giving error the same way, I am beginner and I would really appreciate any support or path that could pass me to try to solve the problem.

  • Instead of the update do .... : NEW.REFERENCE := V_REFERENCIA; but Trigger has to be BEFORE and INSERT ...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.