I just created a trigger on employee table as after updating new value of salary must be large or similar to old salary.
showing error in running trigger showing the code of the trigger
create trigger fix_salary
after update on employee
for each row
when(old.salary>new.salary)
begin
update employee
set salary=:old.salary;
end;
/
after that i added this to a text file and saved it with .plsql extension. then i added to cmd as:- @"path of the flie";
and when i put a update command as:-
update employee set salary=1000 where eid=1;
after that this error is displayed:
update employee set salary=500 where eid=1
*
ERROR at line 1:
ORA-04091: table SYSTEM.EMPLOYEE is mutating, trigger/function may not see it
ORA-06512: at "SYSTEM.FIX_SALARY", line 2
ORA-04088: error during execution of trigger 'SYSTEM.FIX_SALARY'