更新jdbcTemplate不触发触发器

时间:2018-05-07 14:36:05

标签: java oracle triggers jdbctemplate

当我在jdbcTemplate的代码中运行它时,我有更新语句,更新触发器未被触发。

jdbcTemplate.update(updateQueryBuilder.toString(), params.toArray());

触发器

create or replace TRIGGER it_update after  update
   ON im_customer_uda
   FOR EACH ROW
begin
 if :old.Status <> :new.Status then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed Status from ' || :old.Status||' to '|| :new.Status,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.urgency <> :new.urgency then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed urgency from ' || :old.urgency||' to '|| :new.urgency,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.impact <> :new.impact then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed impact from ' || :old.impact||' to '|| :new.impact,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.ttpriority <> :new.ttpriority then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed ttpriority from ' || :old.ttpriority||' to '|| :new.ttpriority,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.reporteddate <> :new.reporteddate then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed reporteddate from ' || :old.reporteddate||' to '|| :new.reporteddate,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.respondeddate <> :new.respondeddate then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed respondeddate from ' || :old.respondeddate||' to '|| :new.respondeddate,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.ttowner <> :new.ttowner then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed ttowner from ' || :old.ttowner||' to '|| :new.ttowner,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.vendorgroup <> :new.vendorgroup then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed vendorgroup from ' || :old.vendorgroup||' to '|| :new.vendorgroup,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.description <> :new.description then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed description from ' || :old.description||' to '|| :new.description,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.actualfaulttime <> :new.actualfaulttime then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed actualfaulttime from ' || :old.actualfaulttime||' to '|| :new.actualfaulttime,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.da <> :new.da then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed da from ' || :old.da||' to '|| :new.da,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.actualresolutiontime <> :new.actualresolutiontime then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed actualresolutiontime from ' || :old.actualresolutiontime||' to '|| :new.actualresolutiontime,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.preventiveaction <> :new.preventiveaction then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed preventiveaction from ' || :old.preventiveaction||' to '|| :new.preventiveaction,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.preventiveactiondue <> :new.preventiveactiondue then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed preventiveactiondue from ' || :old.preventiveactiondue||' to '|| :new.preventiveactiondue,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.drivetest <> :new.drivetest then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed drivetest from ' || :old.drivetest||' to '|| :new.drivetest,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 if :old.assetid <> :new.assetid then insert into log_table(logtxt,ticket_id,updated_date,recid) values ('User '|| :old.updated_by ||' changed assetid from ' || :old.assetid||' to '|| :new.assetid,:old.im_customer_uda_id,sysdate,log_table_s.nextval); end if;
 end;

当我从sqlDeveloper中生成更新语句时,触发器成功触发。任何人都可以帮助我

0 个答案:

没有答案