DB2触发语法之前

时间:2019-04-08 18:25:29

标签: sql database plsql db2 db2-express-c

我已经定义了此触发器:

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>"

有什么想法吗?

1 个答案:

答案 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 ;

使用其他终止符,批处理不会过早执行。