MySQL stored procedure syntax error after BEGIN

Viewed 5908

I am attempting to recreate a stored procedure (since I can't edit the body). I called SHOW CREATE PROCEDURE to use the same format as the original stored procedure but when I attempt to recreate it I get the following errors:

ERROR 1064 (42000): 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 11

ERROR 1064 (42000): 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 'DECLARE organization_id BIGINT(20) UNSIGNED' at line 1

ERROR 1064 (42000): 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 'DECLARE lobby_pod_id BIGINT(20) UNSIGNED' at line 1

Here's the code:

CREATE DEFINER=`lms`@`10.0.0.%` PROCEDURE `create_organization`(
    IN admin_username VARCHAR(255),
    IN organization_name VARCHAR(100)
)
BEGIN
    DECLARE admin_user_id BIGINT(20) UNSIGNED;
    DECLARE organization_id BIGINT(20) UNSIGNED;
    DECLARE lobby_pod_id BIGINT(20) UNSIGNED;

    SELECT ID, account INTO admin_user_id, organization_id 
    FROM users 
    WHERE username = admin_username;

    INSERT INTO pods (`title`, `description`, `owner`, `scene`)
    VALUES (CONCAT(organization_name, " Village"),
            CONCAT("General meeting space and hub for ", organization_name, " students and teachers."),
            admin_user_id,
            " Village"
    );
END

I pasted into SQL Fiddle and got the same result, although pasting into MySQL Syntax Check gave me the thumbs-up. I'm sure it's a simple miss but it isn't that obvious to me.

1 Answers
Related