Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql stored procedure error: missing semicolon

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?

like image 930
Ajay Avatar asked Dec 11 '14 10:12

Ajay


2 Answers

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 ;
like image 181
fancyPants Avatar answered Oct 11 '22 18:10

fancyPants


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

like image 20
Hartmut Holzgraefe Avatar answered Oct 11 '22 20:10

Hartmut Holzgraefe