Mysql的語法錯誤,我有這樣的觸發與觸發
CREATE TRIGGER checkcollision AFTER UPDATE ON players BEGIN
SELECT RAISE(ABORT, 'collision') FROM walls WHERE NEW.x=x AND NEW.y=y;
END;
MySQL的5.1.72-0ubuntu0.10.04.1(Ubuntu的)
但我得到一個語法錯誤,我沒有看到其中...
編輯:
DELIMITER //
CREATE TRIGGER checkcollision AFTER UPDATE ON players BEGIN SELECT RAISE(ABORT, 'collision') FROM walls WHERE NEW.x=x AND NEW.y=y; END//
DELIMITER ;
這仍然得到一個語法錯誤...
這是得到一個語法錯誤:
DELIMITER //
CREATE TRIGGER checkcollision AFTER UPDATE ON players
FOR EACH ROW
BEGIN
IF (SELECT count(*) FROM walls WHERE NEW.x=x AND NEW.y=y)>0 THEN
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Collision detected';
END IF;
END;//
DELIMITER ;
您可能沒有更改'DELIMITER'。 –
我該怎麼做? – omega
@omega:發佈整個語法錯誤消息。除非哪個,我們也看不到...... !!!? –