插入前的DB2触发器无法删除表中的行
CREATE TRIGGER WDW.user_name_search_del
before INSERT ON WDW.user_name_search_b
REFERENCING NEW AS new
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
Delete from wdw.user_name_search_b
where user_name = new.user_name ;--
它抛出错误
在“名称= new.user_name”之后发现意外的标记“ END-OF-STATEMENT”。预期的令牌可能包括:“” .. SQLCODE = -104,SQLSTATE = 42601,DRIVER = 4.9.78 SQL代码:-104,SQL状态:42601
答案 0 :(得分:0)
要修复的两件事:
声明应为:
CREATE TRIGGER WDW.user_name_search_del
before INSERT ON WDW.user_name_search_b
REFERENCING NEW AS new
FOR EACH ROW
MODE DB2SQL
BEGIN
Delete
from wdw.user_name_search_b
where user_name = new.user_name;
END;