In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the custom function of the MySQL database DDL operation example, the content of the article is carefully selected and edited by the author, it has a certain pertinence, and it is of great significance to everyone's reference, the following is to understand the custom function of the MySQL database DDL operation example with the author.
1. Background
* Custom functions are very similar to stored procedures, but must have a return value.
two。 Custom function example [factorial]
* create a custom function func_factorial
Delimiter sets statement Terminator
Mysql > delimiter / / mysql > CREATE FUNCTION func_factorial (total INT)-> RETURNS INT-> BEGIN-> DECLARE i INT;-> DECLARE res INT;-> SET I = 1;-> SET res = 1;-> IF total SET total = 1;-> END IF;-> WHILE i SET res = res * I;-> SET I = I + 1 -> END WHILE;-> RETURN res;-> END; / / Query OK, 0 rows affected (0.01 sec) mysql > delimiter
* call the custom function func_factorial
Mysql > SELECT func_factorial (10); +-+ | func_factorial (10) | +-+ | 3628800 | +-+ 1 row in set (0.01sec)
3. Summary
In order to demand-driven technology, there is no difference in technology itself, only in business.
After reading the above custom functions about MySQL database DDL operation examples, many readers must have some understanding. If you need more industry knowledge and information, you can continue to follow our industry information column.
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.