我已经定义了此触发器:
CREATE TRIGGER actualizarSaldoIngreso
BEFORE INSERT ON Ingreso
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
UPDATE Cliente SET Nombre = 'Juan' WHERE DNI = '87366034M';
END;
但是DB2返回此错误:
An unexpected token "END-OF-STATEMENT" was found following "RE DNI = '87366034M'". Expected tokens may include: "<delim_semicolon>"
有什么想法吗?
答案 0 :(得分:1)
您需要像这样更改终止符:
--#SET TERMINATOR @
CREATE TRIGGER actualizarSaldoIngreso
BEFORE INSERT ON Ingreso
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
UPDATE Cliente SET Nombre = 'Juan' WHERE DNI = '87366034M';
END@
--#SET TERMINATOR ;
使用其他终止符,批处理不会过早执行。