This is the correct way to write a stored procedure and can be executed successfully. Compared with the error message in the above picture, DELIMITER is added. Let me briefly explain the purpose of this command. In MySQL, each line of command ends with ";", and it will automatically execute after pressing Enter. Execution, in the stored procedure, ";" often does not mean the end of the instruction, it will run immediately, and DELIMITER originally means ";", so use this command to convert ";" to "//", so that only "//" is received "Only when the instruction is completed can it be executed
delimiter tells the mysql interpreter whether the command has ended and whether it can be executed. By default, delimiter is a semicolon;, and it will be executed when a semicolon is encountered. The double dollar sign after tells mysql to execute again when it encounters a double dollar sign
This is the correct way to write a stored procedure and can be executed successfully. Compared with the error message in the above picture, DELIMITER is added. Let me briefly explain the purpose of this command. In MySQL, each line of command ends with ";", and it will automatically execute after pressing Enter. Execution, in the stored procedure, ";" often does not mean the end of the instruction, it will run immediately, and DELIMITER originally means ";", so use this command to convert ";" to "//", so that only "//" is received "Only when the instruction is completed can it be executed
delimiter tells the mysql interpreter whether the command has ended and whether it can be executed.
By default, delimiter is a semicolon;, and it will be executed when a semicolon is encountered. The double dollar sign after
tells mysql to execute again when it encounters a double dollar sign