I get this error when updating my table
UPDATE "Username"."EMPPROJECT"
SET ENDDATE = TO_DATE('2016-09-11 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
WHERE ROWID = 'AAF+8XAAEAAGBIGAAB'
AND ORA_ROWSCN = '537035617'
Error saving changes to table "Username"."EMPPROJECT": Row 8:
ORA-04091: table Username.EMPPROJECT is mutating, trigger/function may not see it ORA-06512: at "Username.CHECKOVERLAPDATEUPDATE", line 4
ORA-04088: error during execution of trigger 'Username.CHECKOVERLAPDATEUPDATE'
The trigger is defined like this:
create or replace trigger checkOverlapDateUpdate
before Update on EmpProject
for each row
declare
countOfOverlap integer;
begin
select count(*)
into countOfOverlap
from EmpProject EP
where isOverlapping(:new.startDate, :new.endDate, startDate, endDate) = 1
and EP.EmpID = :new.EmpId;
if countOfOverlap > 0
then
RAISE_APPLICATION_ERROR(-00000, 'Overlapping Insertion Dates');
rollback;
end if;
end;