我做了一个触发器验证了两列,当只有其中一列错误时它会正常显示消息,当两者都错误时我会收到错误
错误代码:1292。截断错误的INTEGER值:''
我相信这是关于Concat的一部分,我在功能上遗漏了什么?
if(RESULTADO = false) then
set msg = "Cpf invalido";
end if;
if(new.idadeproprietario <18) then
set msg2 = "Idade invalida";
end if;
if (msg is not null) or (msg2 is not null) then
select Concat(msg, msg2) into msg3;
Signal sqlstate '40000' set message_text = msg3;
end if;
答案 0 :(得分:0)
更改
select Concat(msg,msg2) into msg3;
到
select Concat(msg,msg2) as msg3;
这应该可以解决问题。
答案 1 :(得分:0)
Warning (Code 1292): Truncated incorrect INTEGER value: '<Some Value>'
在使用CTAS
创建表时,以及将数据插入已创建的表中时,我都收到此错误警告。
之所以发生这种情况,是因为在列值上使用了count()
。使用Sum()
方法代替count()
通常,Select
语句给出的输出没有错误,但是却给出了Warning
(可以通过启用警告\W
进行检查)。 INSERT/CTAS
时会出现错误。