Mysql syntax error

DELIMITER //

CREATE PROCEDURE profile_update(
		IN @stat VARCHAR(1), 
		IN @fname VARCHAR(50), 
		IN @lname VARCHAR(50), 
		IN @email VARCHAR(120), 
		IN @org VARCHAR(120), 
		IN @phone VARCHAR(14), 
		IN @other VARCHAR(120), 
		IN @time VARCHAR(120), 
		IN @state VARCHAR(120), 
		IN @street VARCHAR(200), 
		IN @city VARCHAR(50), 
		IN @back VARCHAR(50), 
		IN @gender VARCHAR(1), 
		IN @day DATE, 
		IN @me INT(11)
	)

	BEGIN	
		
		DECLARE EXIT HANDLER FOR SQLEXCEPTION
			BEGIN
				SELECT "Unable to update profile" AS error;
				ROLLBACK;
			END;
		

		START TRANSACTION;
				
			UPDATE players
			SET 
				status = @stat, 
				first_name = @fname, 
				last_name = @lname, email = @email, phone = @phone, other = @other, 
				gender = @gender, background = @back, street = @street, city = @city, birthday = @day, 
				timezone = ( SELECT t.id FROM `internal-timezones` AS t WHERE t.zone = @time LIMIT 1 ),
				countryId = ( SELECT c.id FROM `internal-countries` AS c WHERE c.id = @state LIMIT 1 )
			WHERE id = @me AND email = @org
			LIMIT 1;
			
			INSERT INTO players_activity_log ( date, playerId, table_name, table_id ) VALUES ( NOW(), @me, "players", @me );
		
		COMMIT;

	END //

DELIMITER ; 

Open in new window


Hi,

I cannot for the life of me see the error here?

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 'DELIMITER' at line 1

thanks for your help
LVL 6
J NUnicorn wranglerAsked:
Who is Participating?
 
Brian DayhoffConnect With a Mentor Senior Full Stack DeveloperCommented:
It is interpreting your delimiter as a comment, which resolves to the compiler as an empty delimiter statement. Do not use any of the following as delimiters:

//

/*

*/

#

--

If you have content that has to be separated by one of these, you need to run a pre or post filter at the application level, such as with python or java to run conversion prior to sql generation.
0
 
PortletPaulConnect With a Mentor freelancerCommented:
Try it with

DELIMITER \\
...
END \\
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.