In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to implement mysql stored procedures". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's ideas to study and learn "how to implement mysql stored procedures".
Stored procedure
Stored procedures can be thought of as SQL functions and can pass parameters (variables)
A stored procedure can encapsulate a long string of SQL code into a module, a class class, and call loops.
It is not recommended to use stored procedures. If you really need to pass parameter variables, it is recommended to use the parameters of python.
Stored procedure-mysql example
The steps of the sample procedure are explained in detail:
By parameter: auto_tbcrm_order
Delete temporary table: temp_tbcrmorder_tbcrm
Create a temporary table: temp_tbcrmorder_tbcrm, and the data source comes from all the contents of the auto_tbcrm_order table
# consolidation of order data in Taobao system
Drop procedure if exists insert_update_tbcrm
Create procedure insert_update_tbcrm (in tbcrmorder_name varchar)
BEGIN
# # order data preprocessing
SET @ STMT: = CONCAT ("drop table if exists temp_tbcrmorder_tbcrm")
PREPARE STMT FROM @ STMT
EXECUTE STMT
SET @ tbl_name = CONCAT (tbcrmorder_name)
SET @ STMT: = CONCAT ("create table temp_tbcrmorder_tbcrm", "select * from", @ tbl_name, ";")
PREPARE STMT FROM @ STMT
EXECUTE STMT
# create index id on temp_tbcrmorder_tbcrm (orderid,orderstatus)
# ALTER TABLE temp_tbcrmorder_tbcrm ADD unique KEY (orderid)
End
Call insert_update_tbcrm ('auto_tbcrm_order')
The above stored procedure, but there are two stored procedure steps
Thank you for your reading, the above is the content of "how to implement mysql stored procedures". After the study of this article, I believe you have a deeper understanding of how to achieve mysql stored procedures, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.