Mysql – cannot create a procedure with error [1064] [42000]

MySQLmysql-5.7

I am using mysql 5.7 and I have some code which works. But when I try to create procedure with the code, it reports error [1064] [42000]. I try to update the content of an old procedure with my current code and it works. Does someone know why this happens?

Here is how I try to create a procedure.

create procedure dispatch_remaintimecal_12division (in lgtid VARCHAR(20))
begin
my code;
end

Best Answer

ERROR 1064 (42000): states that "You have an error in your SQL syntax". Can you specify what is being executed as 'my code'. That is where SQL syntax appears to be going wrong. Make sure you are within the right database before calling your procedure.

eg: USE dbname;