CREATE TRIGGER Transaction_insert BEFORE INSERT ON Transaction
FOR EACH ROW
IF Account.CreditBalance + NEW.Amount < Account.CreditLimit WHERE Number = NEW.AccountNumber THEN
UPDATE Account SET CreditBalance = CreditBalance + NEW.Amount where Number = NEW.AccountNumber;
ELSE
SET NEW.Valid = 0
END IF;
我从phpMyAdmin收到此错误消息。
答案 0 :(得分:2)
这是If语句的正确语法。
IF search_condition THEN statement_list
[ELSEIF search_condition THEN statement_list] ...
[ELSE statement_list]
END IF
你不能在那个地方拥有Where
条款!