MySQL/phpMyAdmin freezes from DELIMITER

て烟熏妆下的殇ゞ 提交于 2019-12-31 00:45:26

问题


Running this procedure causes MySQL (or phpMyAdmin) to freeze. I have to stop MySQL with from XAMPP command, which freezes and "is not responding" about 20 seconds before stopping. I believe this is caused by the delimiter command, which on it's own begins the problems. I have tried using a different delimiter ("//") to no effect.

DELIMITER $

CREATE TRIGGER coroner AFTER INSERT ON events
FOR EACH ROW BEGIN
UPDATE teams WHERE id = NEW.victim SET live = live-1;
UPDATE teams WHERE id = NEW.shooter SET score = score+points;
END

$

DELIMITER ;

回答1:


As it turns out, phpMyAdmin has a field marked "delimiter:" below the SQL query box. Using it rather than the command solves the problem. Further research explains that "DELIMITER" is not a SQL command, but a command generally implemented by all SQL ui's.




回答2:


the update command should:

update teams set live = live-1 where id = new.victim;
update teams where id = new.shooter set score = score+points;

the where after the set clause



来源:https://stackoverflow.com/questions/2068331/mysql-phpmyadmin-freezes-from-delimiter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!