DB2触发更新

时间:2017-01-10 09:47:19

标签: db2 db2-luw database-trigger

我的表格ORDERS包含很多列:(ORDERS_ID, MEMBER_ID, STATUS, ANY MORE....)STATUS时,我会在新状态“M”中进行更改,我会将ORDERS_ID, MEMBER_ID, STATUS保存在另一个表XORDERSAUDIT中。 我写了这个:

CREATE or replace TRIGGER Order_Status_Update_Trigger
     AFTER UPDATE OF STATUS ON ORDERS
     REFERENCING NEW AS N
     FOR EACH ROW
     WHEN (N.STATUS = 'M')
     BEGIN ATOMIC
       INSERT INTO XORDERSAUDIT
         (ORDER_ID, USERS_ID, STATUS) VALUES (N.ORDERS_ID, N.MEMBER_ID, N.STATUS);
     END;

我有这个错误:

  

DB2 SQL错误:SQLCODE = -104,SQLSTATE = 42601,   SQLERRMC = END-OF-STATEMENT; MEMBER_ID,N.STATUS);,   DRIVER = 4.19.66 SQLState:42601 ErrorCode:-104发生错误:

我不明白错误,我尝试纠正但遇到同样的错误,请帮帮我。

0 个答案:

没有答案