Mysql’s stored procedure is really a pit! There is nothing wrong with asking for help from the following stored procedures, and there is really no problem to find.

  mysql, question

Begin

declare step1,step2 varchar(50);
 declare p_tar_code varchar(10);
 DECLARE p_tYear,p_period int;
 DECLARE p_centAll,p_up_comCent decimal(5,2);
 
 -1: Obtain the current year and quarter
 select period,tyear into p_period,p_tYear from tm_checkmain where id = 95 LIMIT 1;
 
 -2: If the quarter is 1, the score for the previous year will be 0, otherwise it will be calculated
 if period = 21 then
 set p_up_comCent = 0;
 end if

select tar_code into p_tar_code from tm_checkdetails where id = 95 LIMIT 1;

set str = p_tar_code;

End

IF the judgment is commented out, it will pass, otherwise it will report an error.

One or more errors have occurred while processing your request:
The following query failed: “CREATE DEFINER=RootAt signlocalhostProcedurecomCent(INcm_idINT(11) UNSIGNED, OUTstrVARCHAR(10)) NO SQL SQL SECURITY DEFINER BEGIN declare step1,step2 varchar(50); declare p_tar_code varchar(10); DECLARE p_tYear,p_period int; DECLARE p_centAll,p_up_comCent decimal(5,2); -1: get the current year and quarter selectperiod, tyearinto p _ period, p _ tyearfromtm _ checkmainwhere id = 95limit1; -2: if the quarter is 1, the score for the previous year is 0; otherwise, if period = 21 then set p _ up _ comcent = 0; end if — select tar_code into p_tar_code from tm_checkdetails where id = 95 LIMIT 1; -setstep 2 =’ return if it is a month’; — set str = p_tar_code; END”
MySQL returned: # 1064-youhave an error in yousql syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘END’ at line 22

Ask a superior, IF judgment is not wrong at all.

end ifDifference semicolon