每当EDI_INVOICE
仅为特定DOCUMENT_TYPE
BILL_TO_CODES
设置为False
这就是我编写触发器的方式
CREATE TRIGGER BT_CU_CASS_REBILLS
AFTER UPDATE OF DOCUMENT_TYPE ON TLORDER
REFERENCING OLD AS O NEW AS N
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
IF N.DOCUMENT_TYPE <> O.DOCUMENT_TYPE AND N.DOCUMENT_TYPE = 'REBILL'
AND N.BILL_TO_CODE IN (SELECT TRADING_PARTNER FROM EDI_PROFILES WHERE EDI_TYPE = '210' AND EDI_ACTIVE = 'True' AND UPPER(FTP_ADDRESS) LIKE '%CASS%')
THEN SET N.EDI_INVOICE = 'True';
END IF;
END
但是当尝试执行Query来创建触发器时,我得到了这个错误
SQL0797N The Trigger Lynx.BT_CU_CASS_REBILLS is defined with an unsporrted triggered SQL statement. Line Number = 11. SQLSTATE = 42987
提前谢谢你。
答案 0 :(得分:3)
如果您希望触发器更改触发器触发的行中的数据,即
THEN SET N.EDI_INVOICE = 'True';
您需要使用BEFORE UPDATE
触发器。