In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article is about what stored procedures are in the mysql database. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
Mysql stored procedure is a set of SQL statements that are stored in the database in order to complete a specific function in a large database system. It is called again after the first compilation and does not need to be compiled again. Users execute it by specifying the name of the stored procedure and giving parameters.
The mysql stored procedures are:
1. What is a stored procedure
A stored procedure (Stored Procedure) is a set of SQL statements that are stored in the database in order to complete a specific function in a large database system. It is called again after the first compilation and does not need to be compiled again. The user executes it by specifying the name of the stored procedure and giving parameters (if the stored procedure has parameters). Stored procedure is an important object in database, and any well-designed database application should use stored procedure.
2. Create a stored procedure
Format:
DELIMITER $$CREATE PROCEDURE `ProcedureName` (paramName paramType) BEGIN END$$ DELIMITER
The red font explains:
ProcedureName: the name of the stored procedure you want to create
ParamName: parameter name
ParamType: parameter typ
Note:
(1) whether the stored procedure needs parameters depends on the actual situation (parentheses may not be filled in)
(2) MySQL has supported stored procedures since 5. 0
(3) DELIMITER and DELIMITER; means delimiters, and their function is to let the compiler know that their contents are stored procedures. If these two parts are not written, the compiler will execute this code as normal SQL.
(4) the content of the stored procedure is between BEGIN and END, and our SQL is written in the middle.
3. Advantages and disadvantages of stored procedures
(1) the execution speed is fast. Because the stored procedure has been precompiled, the compilation part is skipped directly when in use, so the execution speed will be faster.
(2) reduce network traffic. When using a stored procedure, you only need to call the method of the stored procedure. Compared with the method name of the SQL statement stored procedure, the network transfer calls the stored procedure statement, which reduces the network traffic.
(3) reusability. Create it at once, and you can use it freely if you meet the demand.
Thank you for reading! About what the stored procedures in the mysql database are shared here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.