mysql存储过程错误:缺少分号

时间:2014-12-11 10:25:25

标签: mysql stored-procedures

我有以下商店程序。它给了我一些错误

DROP procedure IF exists getQueueMessage;
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `getQueueMessage`(msg varchar(100))
BEGIN

SELECT `Name` FROM queues WHERE Id  IN (
SELECT PhysicalQueueId FROM indexqueuemaps WHERE ConditionFieldValue = msg)
END
END$$
DELIMITER ;

它给了我missing semicolon error。不知道为什么会出现这个错误。有人能帮助我吗?

3 个答案:

答案 0 :(得分:23)

试试这样:

DROP procedure IF exists getQueueMessage;
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `getQueueMessage`(msg varchar(100))
BEGIN

SELECT `Name` FROM queues WHERE Id  IN (
SELECT PhysicalQueueId FROM indexqueuemaps WHERE ConditionFieldValue = msg);
END$$
DELIMITER ;

答案 1 :(得分:4)

只有一个BEGIN和两个END,删除第二个END,你应该没问题。

答案 2 :(得分:-3)

root @ localhost替换为root @ localhost