Why does my statement result in a syntax error? I tried to run this SQL statement in MySQL 5.5 and 5.7.1 but always got error.

DELIMITER //
CREATE PROCEDURE one_off_update_user_info_view_type()
  BEGIN
    DECLARE @batchsize BIGINT DEFAULT 1;
  END
//




You could check the script in local MySQL 5.5+ since it does not contain any business logic or inner-company databases. Could anyone tell me why the error arose and how to fix it?
You use DECLARE in compound-statement syntax to declare a local variable, cursor, condition or handler. However, your variable @batchsize is a session global variable due to the presence of the @ prefix, and it is an error to attempt to redeclare a global variable.

Change the name of your variable from @batchsize to batchsize, and then read up on MySQL variables.