mysql trigger operand should contain 2 columns

2020-02-07 06:33发布

问题:

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