Home >Database >Mysql Tutorial >How to call stored procedure in mysql
Mysql method of calling stored procedures: You can use the CALL statement to call stored procedures, the syntax is [CALL sp_name([parameter])]. Calling stored procedures can make program execution more efficient and enhance program reusability and maintainability.
MySQL must use the call statement to call a stored procedure, and the stored procedure needs to be related to the database. If it is not related, the database name needs to be specified.
(Recommended tutorial: mysql video tutorial)
Using stored procedures can make program execution more efficient, safer, and enhance program reusability and Maintainability
Calling stored procedures
There are many ways to call stored procedures
Stored procedures must be called using the CALL statement, and the stored procedure and database Related, if you want to execute stored procedures in other databases, you need to specify the database name
Syntax format
CALL sp_name ([parameter [,……]])
Parameter description
Sp_name, is the name of the stored procedure
parameter, is the parameter of the stored procedure
Define a stored procedure named CountProc1, and then call this stored procedure
Define stored procedure
Call stored procedure
View the returned results
The above is the detailed content of How to call stored procedure in mysql. For more information, please follow other related articles on the PHP Chinese website!