-2
I have a table emp with salary, id, and job and added a new column value in this column. I will update when the employee receives a raise. I created a support table where I have id , salary,date and new_salary I created the first one trigger when there is a insert in table a trigger fires and inserts into the support table (it’s working so far), then I need to update the table emp with value = new salary - salary. I compiled the trigger but when I execute update table emp appears error: ora-06519: active autonomous transition and if I take the pragma the mistake changes to: ora-04091:the table emp_log is mutant
Original text for consultation: I have a table emp with salary, id, and job and add a new column value in this column I will do update when Employee receive an Increase. I created a table support when I have id , salary,date and new_salary I created a first Trigger when a Insert in table emp the Trigger Shoots and Insert in table support (it’s Working until here) , after I need update the table emp with value = new salary - salary. I Compiled Trigger but when I execute update on emp show error: ora-06519: active Autonomous Transition and if I take pragma change error to: ora-04091:the table emp_log is Mutant
CREATE OR REPLACE TRIGGER new_salario_emp
AFTER INSERT
ON emp_log
FOR EACH ROW
--
DECLARE
Pragma Autonomous_Transaction;
--
BEGIN
--
update emp_log set old_salario = :new.sal - :new.old_salario where empno =
:new.empno;
--
END;
You may not have noticed (which is strange), but we are on [pt.so], so you can (and should) ask the question in Portuguese. Take the [tour] now and read the [Ask] guide. If you have any questions, go to [help] and/or [meta].
– Woss