У меня есть две таблицы: project
и postponedproject
После обновления duedate
в project
я создал три триггера: change_project_duedate
и postponedproject_status
и postponedproject_difference
Первый - взять старый и обновленный duedate
и первичный ключ таблицы проекта prono
в таблицу postponedproject
:
create or replace trigger change_project_duedate
after update of duedate on project
for each row
begin
insert into postponedproject (Prono, oldduedate, newduedate, status, difference, reason)
values (:old.prono, :old.duedate, :new.duedate, null, null, null);
end;
Второй - посмотреть, является ли newduedate
более поздним, чем старый oldduedate
, или нет, а затем поместить значение в postponedproject.status
:
create or replace trigger postponedproject_status
before insert on postponedproject
for each row
declare
differencestatement postponedproject.status%type;
begin
if :new.newduedate > :new.oldduedate then
differencestatement := 'Project has been delayed';
Else
differencestatement := 'Project has been scheduled to finish eariler';
end if;
insert into postponedproject (status)
values (differencestatement);
end;
Третий - поместить значение difference
между oldduedate
и newduedate
в таблице postponedproject
:
create or replace trigger postponedproject_difference
before insert on postponedproject
for each row
begin
:new.difference := :new.newduedate - :new.oldduedate;
end;
Однако, когда я обновляю duedate
в таблице проекта, это выдало мне такую ошибку:
Error report -
ORA-00036: maximum number of recursive SQL levels (50) exceeded
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04088: error during execution of trigger '21363937.POSTPONEDPROJECT_STATUS'
ORA-06512: at "21363937.POSTPONEDPROJECT_STATUS", line 9
ORA-04
Я действительно ценю, если кто-нибудь может мне помочь. Большое вам спасибо