Home > Database > Mysql Tutorial > How to call stored procedure in mysql

How to call stored procedure in mysql

清浅
Release: 2020-09-16 15:51:37
Original
16747 people have browsed it

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 [,……]])
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template