mysql stored procedure error: missing semicolon

时间:2021-09-16 22:53:44

I have following store procedure. It is give me some error

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

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 ;

It is giving me missing semicolon error. Don't know Why this error is getting. Can someone help me?

这让我错过了分号错误。不知道为什么会出现这个错误。有人能帮我吗?

3 个解决方案

#1


22  

Try like this:

试试这样:

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 ;

#2


4  

There's only one BEGIN and two ENDs, remove the 2nd END and you should be fine.

只有一个BEGIN和两个END,删除第二个结束,你应该没事。

#3


-3  

Replace root@localhost with root@localhost

用root @ localhost替换root @ localhost

#1


22  

Try like this:

试试这样:

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 ;

#2


4  

There's only one BEGIN and two ENDs, remove the 2nd END and you should be fine.

只有一个BEGIN和两个END,删除第二个结束,你应该没事。

#3


-3  

Replace root@localhost with root@localhost

用root @ localhost替换root @ localhost