mysql trigger operand should contain 2 columns

空扰寡人 提交于 2019-11-27 08:45:02

问题


My trigger looks like this:

begin
IF ((NEW.tgebucht >= NEW.tteilnmax) AND (NEW.tgebucht!=0) AND (OLD.tstatus=0)) THEN
  SET NEW.tstatus = 1;
ELSEIF ((NEW.tgebucht < NEW.tteilnmax) AND (OLD.tstatus=1)) THEN
  SET NEW.tstatus =0;
END IF;
IF ((0,25*NEW.tteilnmax)>=(NEW.tteilnmax-NEW.tgebucht)) THEN
    SET NEW.trestplatze =1;
END IF;
end

And I am getting an error like this:

Operand should contain 2 column(s)

I am not really sure why, I know it is related to second if but I can't configure where, does anyone has an idea what to change? Am I doing something wrong here? Any help would be appreciated.


回答1:


The syntax looks well. But there is a hidden bug in next line -

IF ((0,25*NEW.tteilnmax)>=(NEW.tteilnmax-NEW.tgebucht)) THEN

You should use '.' as a point delimiter -

IF ((0.25*NEW.tteilnmax)>=(NEW.tteilnmax-NEW.tgebucht)) THEN


来源:https://stackoverflow.com/questions/20498794/mysql-trigger-operand-should-contain-2-columns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!