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 > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I would like to share with you the relevant knowledge of how to define variables in mysql stored procedures. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
In mysql stored procedures, you can use the DECLARE keyword to define variables with the syntax "DECLARE variable name [,...] type [DEFAULT default]"; the parameter "type" is used to specify the type of variable, and the "DEFAULT" clause is used to set the default value for the variable.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
Variables are the most basic elements in expression statements and can be used to store data temporarily. Variables can be defined and used in both stored procedures and functions. Users can use the DECLARE keyword to define variables, after which they can assign values to variables. The scope of these variables is in the BEGIN...END program segment.
Define variable
Variables can be defined using the DECLARE keyword in MySQL, and the basic syntax is as follows:
DECLARE var_name [,...] Type [DEFAULT value]
Where:
The DECLARE keyword is used to declare variables
The var_name parameter is the name of the variable, where multiple variables can be defined at the same time.
The type parameter is used to specify the type of variable
The DEFAULT value clause sets the variable default value to value, and when the DEFAULT clause is not used, the default value is NULL.
Example
The variable my_sql is defined below, the data type is INT, and the default value is 10. The SQL statement is as follows:
DECLARE my_sql INT DEFAULT 10; that's all of the article "how to define variables in mysql stored procedures". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
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.