我在以下代码中收到错误。
CREATE TRIGGER au_auction AFTER UPDATE ON dmtable
FOR EACH ROW
BEGIN
IF NEW.bid > OLD.bid THEN
INSERT INTO auction_log(auction,id,ts,item,bid) VALUES('update',NEW.id,NEW.ts,NEW.item,NEW.bid);
END IF;
END;
问题出在语法层面......你能不能给出更多的光?
这是错误消息:
Error Code: 1064. 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
MySql 5.x
谢谢
答案 0 :(得分:1)
DELIMITER //
CREATE TRIGGER au_auction AFTER UPDATE ON dmtable
FOR EACH ROW
BEGIN
IF NEW.bid > OLD.bid THEN
INSERT INTO auction_log(auction,id,ts,item,bid)
VALUES('update', NEW.id, NEW.ts, NEW.item, NEW.bid);
END IF;
END//
DELIMITER ;