当前位置:网站首页>How to write the statement of executing stored procedure in MySQL

How to write the statement of executing stored procedure in MySQL

2022-06-21 07:31:00 Yisu cloud

mysql How to write statements that execute stored procedures in

This article mainly introduces mysql How to write the statements that execute stored procedures in , The content is detailed and easy to understand , The operation is simple and fast , It has certain reference value , I believe that after reading this article mysql How to write an article about the statements that execute stored procedures in , Let's have a look .

mysql The statement that executes the stored procedure in is “CALL”.CALL Statement can call the specified stored procedure , After calling the stored procedure , The database system will execute SQL sentence , Then return the result to the output value ; The grammar is “CALL The name of the stored procedure ([ Parameters [...]]);”.mysql In the use of CALL Statement to call and execute a stored procedure requires EXECUTE Permission can only take effect .

mysql How to write statements that execute stored procedures in

The operating environment of this tutorial :windows7 System 、mysql8 edition 、Dell G3 The computer .

mysql The statement that executes the stored procedure in is “CALL”.

MySQL CALL sentence

MySQL Use in CALL Statement to call the stored procedure . After calling the stored procedure , The database system will execute SQL sentence , Then return the result to the output value .

To call and execute a stored procedure, you need to have EXECUTE jurisdiction (EXECUTE Information about permissions is stored in information_schema Database based USER_PRIVILEGES In the table ).

CALL Statement to receive the name of a stored procedure and any parameters that need to be passed to it , The basic grammatical form is as follows :

CALL sp_name([parameter[...]]);

among ,sp_name Represents the name of the stored procedure ,parameter Parameters representing stored procedures .

MySQL CALL Statement to call and execute a stored procedure

Create name as ShowStuScore Stored procedure , The function of the stored procedure is to query the student's grade information from the student's grade information table

DELIMITER //CREATE PROCEDURE ShowStuScore()BEGINSELECT * FROM tb_students_score;END //

mysql How to write statements that execute stored procedures in

Call and execute stored procedures ShowStuScore()

CALL ShowStuScore();

mysql How to write statements that execute stored procedures in

explain : Because a stored procedure is actually a function , So the stored procedure name needs to be followed by ( ) Symbol , Even if you don't pass parameters, you need .

About “mysql How to write statements that execute stored procedures in ” That's all for this article , Thank you for reading ! I'm sure you're right “mysql How to write statements that execute stored procedures in ” Knowledge has a certain understanding , If you want to learn more , Welcome to the Yisu cloud industry information channel .

原网站

版权声明
本文为[Yisu cloud]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206210727173980.html