Today, a stored procedure is executed in the MySQL database, and because the MySQL data connection tool is not installed, it is executed in the black box and then the following problem is encountered:
Always said it was my problem with the syntax of the stored procedure, but looked for a long time did not see the problem, and then checked the morning information only to occur the problem:
in MySQL, ";" would be the end of an SQL statement, so when you execute a database script using the source command, when you encounter the ";" Symbol, the database will assume that you have finished writing a SQL statement, he will automatically execute this sentence, then there is a problem, To solve this problem, you can use the delimiter command to customize the end flag of a statement, and then you can execute the stored procedure successfully. Remember to change the end-of-statement flag at the end of the stored procedure.
Cases:
-- ------------------------------Procedure structure for ' proc_adder '-- ----------------------------DROP PROCEDURE IF EXISTS' Proc_adder ';D elimiter;;CREATEDefiner=' Root ' @ ' localhost 'PROCEDURE' Proc_adder ' (inchAint,inchBint, outsum int)BEGIN#Routine body goes here ...DECLARECint; ifA is NULL Then SetA= 0; End if; ifB is NULL Then SetB= 0; End if; Set sum =A+b;END;;D Elimiter;
MySQL database performs stored procedure issues