本帖最后由 林洲 于 2011-12-8 17:05 编辑
乎乎,终于解决了- CREATE TRIGGER "update_830309794" after update ON "AICJXOPT"."TB_NTMM_ENTINFO"
- REFERENCING NEW as NEWO FOR EACH ROW MODE DB2SQL
- BEGIN ATOMIC
- DECLARE v_MsgTypeId integer;
- DECLARE v_MsgServiceId integer;
- DECLARE v_QueuedAt timestamp;
- set v_QueuedAt = current timestamp;
- SET v_MsgTypeId = (SELECT MsgTypeId FROM BCG_MsgType where MsgTypeName = 'UU_TB_NTMM_ENTINFO_do');
- SET v_MsgServiceId = (SELECT MsgServiceId FROM BCG_MsgService where MsgServiceName = 'TB_NTMM_WEBSITE');
- INSERT INTO BCG_Msg ( MsgServiceId, MsgTypeId, MsgQueuedAt, MsgQueuedAtSeqNo, MsgStatus,MsgDeliveredAt, MsgFailedText,OperationType,MsgParam1, MsgParam2, MsgParam3, MsgParam4, MsgParam5,MsgParam6, MsgParam7, MsgParam8, MsgParam9, MsgParam10)
- VALUES (v_MsgServiceId, v_MsgTypeId,v_QueuedAt, null, 'NEW',null,'','update',char(NEWO."ENTID"),'','','','','','','','','');end;
复制代码 上边是原来触发器的代码,只需在set v_QueuedAt = current timestamp处,加上几句代码就OK了- --测试字段
- CREATE TRIGGER "update_830309794" after update ON "AICJXOPT"."TB_NTMM_ENTINFO"
- REFERENCING NEW as NEWO OLD as OLDO FOR EACH ROW MODE DB2SQL
- BEGIN ATOMIC
- DECLARE v_MsgTypeId integer;
- DECLARE v_MsgServiceId integer;
- DECLARE v_QueuedAt timestamp;
- if NEWO.ENTNAME<>OLDO.ENTNAME or NEWO.DOM<>OLDO.DOM then set v_QueuedAt = current timestamp;
- SET v_MsgTypeId = (SELECT MsgTypeId FROM BCG_MsgType where MsgTypeName = 'UU_TB_NTMM_ENTINFO_do');
- SET v_MsgServiceId = (SELECT MsgServiceId FROM BCG_MsgService where MsgServiceName = 'TB_NTMM_WEBSITE');
- INSERT INTO BCG_Msg ( MsgServiceId, MsgTypeId, MsgQueuedAt, MsgQueuedAtSeqNo, MsgStatus,MsgDeliveredAt, MsgFailedText,OperationType,MsgParam1, MsgParam2, MsgParam3, MsgParam4, MsgParam5,MsgParam6, MsgParam7, MsgParam8, MsgParam9, MsgParam10)
- VALUES (v_MsgServiceId, v_MsgTypeId,v_QueuedAt, null, 'NEW',null,'','update',char(NEWO."ENTID"),'','','','','','','','','');
- end if;
- end
复制代码 |