I am trying to create a database trigger to update a value entered by the user. The trigger compiles fine but I keep getting error messages when I test the trigger. Below is the error message I am getting and the code I am trying to use.
ORA-04091: table SCOTT.EMP2 is mutating, trigger/function may not see it
CREATE OR REPLACE TRIGGER Add_Any_Emp
AFTER INSERT ON EMP
FOR EACH ROW
v_SAL := :NEW.SAL;
IF v_SAL > 20000 THEN
SET SAL = 20000
WHERE EMP.EMPNO = :NEW.EMPNO;
How doI overcome this?
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!