PL / SQL Trigger получает ошибку изменяющейся таблицы

Мой триггер хочет проверить, контролирует ли «новый» менеджер не более 5 сотрудников. Менеджер, контролирующий только 5 человек, находится в таблице BLOCKED_MANAGER (ssn, numberofemployees). Наконец, каждое обновление записывается в таблицу SUPERLOG (дата, пользователь, old_manager, new_manager). Я не получаю ошибку компиляции о триггере, но когда я обновляю superssn, я получаю эту ошибку:

SQL> update employee set superssn='666666607' where ssn='111111100';
update employee set superssn='666666607' where ssn='111111100'
   *
ERROR at line 1:
ORA-04091: Table FRANK.EMPLOYEE is mutating, the trigger/function
can't read it
ORA-06512: a "FRANK.TLOG", line 20
ORA-04088: error during execution of trigger 'FRANK.TLOG'

Как я могу решить этот триггер? Спасибо

create or replace trigger tlog 
before update of superssn on employee
for each row
declare
t1 exception;
n number:=0;
cont number:=0;
empl varchar2(16);
cursor cur is (select ssn from blocked_manager where ssn is not null);
begin
open cur;
    loop
fetch cur into empl;
exit when cur%notfound;
if(:new.superssn = empl) then
    n:=1;
end if;
end loop;
close cur;
if n=1 then
raise t1;
end if;
select count(*) into cont from employee group by superssn having superssn=:new.superssn;
if(cont=4) then
insert into blocked_manager values(:new.superssn,5);
end if;
insert into superlog values(sysdate,user,:old.superssn, :new.superssn );
exception
when t1 then
raise_application_error(-20003,'Manager '||:new.superssn||' has already 5 employees');
end;

Ответы на вопрос(2)

Ваш ответ на вопрос