Home  >  Article  >  Database  >  How to call stored procedure in mysql

How to call stored procedure in mysql

清浅
清浅Original
2019-05-07 17:26:5516709browse

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.

How to call stored procedure in mysql

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

How to call stored procedure in mysql

Call stored procedure

How to call stored procedure in mysql

View the returned results

How to call stored procedure in mysql

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more