oracle - ORA-25028: regular trigger body can not start with keyword COMPOUND -


i getting mutating error trigger created. hence, changed trigger use compound trigger. have compound trigger below:

create or replace trigger trig_chpt_update after update on task_status compound trigger /* declaration section */ task_id number(15); ckpt_id number(15); count_of_ckpt number(15); record number(15); ckpt_completed number(15):=0; total_ckpt number(15):=0;  cursor cur_task_ckpt select c.taskid, c.ckpt_id, ts.status checkpoint c inner join    task_status ts on c.ckpt_id=ts.ckpt_id;  after each row begin /* taskid of checkpoint status being updated */ select taskid task_id checkpoint ckpt_id=:new.ckpt_id; end after each row;  after each statement begin /* number of checkpoints task */ --select count(*) count_of_ckpt checkpoint taskid=task_id;  /* checking assumption */ open cur_task_ckpt; record in cur_task_ckpt loop   if record.taskid=task_id      total_ckpt:=total_ckpt+1;      if record.status=1         ckpt_completed:=ckpt_completed+1;      end if;   end if; end loop; dbms_output.put_line(ckpt_completed||' of '||total_ckpt||' checkpoints associated task id '||task_id||'have been completed.');  close cur_task_ckpt; end after statement;  end trig_chpt_update; 

but when execute it, error ora-25028: regular trigger body can not start keyword compound . please let me know going wrong.

i believe need change

create or replace trigger trig_chpt_update after update on task_status compound trigger 

to

create or replace trigger trig_chpt_update update [of field] on task_status compound trigger 

edit

after verifying, confirm proper syntax is

create or replace trigger compound_trigger_name [insert|delete|update] [of column] on table compound trigger 

note coumpound trigger introduced in oracle 11g.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -