Mysql stored procedure error: semicolon missing

I have the following storage procedure. This gives 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 ; 

This gives me the missing semicolon error . I do not know why this error occurs. Can anybody help me?

+6
source share
3 answers

Try it 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 ; 
+17
source

There is only one BEGIN and two END s, delete the second END , and everything will be fine.

+3
source

Replace root @ localhost with root @ localhost

-2
source

Source: https://habr.com/ru/post/979449/


All Articles