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!
No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.
Your password has been sent to:firstname.lastname@example.org
To follow this tag...
Thanks! We'll email you when relevant content is added and updated.
Share this item with your network: