MySQL stored procedure BEGIN / END statements throwing errors
mysql
Solution
You should define the delimiter:
DELIMITER $$
DROP PROCEDURE IF EXISTS sp_transpose_tickets $$
CREATE PROCEDURE sp_transpose_tickets ()
BEGIN
select 1;
END$$
DELIMITER ;
Problem
I'm trying to run a stored procedure and having real issues debugging. I've tried cutting everything out to try and track down the issue, and even down to this I'm getting errors: ``` DROP PROCEDURE IF EXISTS sp_transpose_tickets; CREATE PROCEDURE sp_transpose_tickets () BEGIN select 1; END ``` errors are: ``` > Error : You have an error in your SQL syntax; check the manual that > corresponds to your MySQL server version for the right syntax to use > near '' at line 2 > > Error : You have an error in your SQL syntax; check the manual that > corresponds to your MySQL server version for the right syntax to use > near 'END' at line 1 ``` This is on my local machine, under root user so all privileges are granted and I am running mySQL 5.5.20.