CREATE TRIGGER `update_balance` AFTER UPDATE ON `trading`
FOR EACH ROW BEGIN
IF (NEW.`line` = 'up' AND NEW.`price_end` > NEW.`price`) THEN
BEGIN
UPDATE `clients` SET `balance` = `balance` + NEW.`sum` * 1.85 WHERE `email` = NEW.`user_id`;
END
ELSE IF (NEW.`line` = 'down' AND NEW.`price_end` < NEW.`price`) THEN
BEGIN
UPDATE `clients` SET `balance` = `balance` + NEW.`sum` * 1.85 WHERE `email` = NEW.`user_id`;
END
END
END;
Выдает ошибку, что может быть не так?
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5
5 строка, это первый UPDATE