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 mainly introduces the method of creating functions in mysql, which has certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
How to create a function in mysql: first, check whether the function is enabled; then, if the value of Value is OFF, you need to enable it; then, when creating a function, select the database first; finally, you can test it.
The method to create a function in mysql:
1. Check whether the function to create a function is enabled:
Mysql > show variables like'% func%' +-- +-+ | Variable_name | Value | +-+-+ | Log_bin_trust_function_creators | ON | +-- +-+ 1 row in set (0.02 sec)
Second, if the value of Value is OFF, you need to turn it on.
Mysql > set global log_bin_trust_function_creators=1
Third, when creating a function, select the database first
Mysql > use xxx;Database changeddelimiter $$is to set $$as the command termination symbol instead of the semicolon, because the semicolon is used in begin...end; mysql > delimiter $$CREATE FUNCTION first_func (param1 varchar (5), parmam2 varchar (5), param3 varchar (10)) RETURNS TINYINTBEGIN RETURN 1nd
After the function is created successfully, you need to restore the semicolon to the command termination symbol.
Mysql > delimiter
4. Testing:
Mysql > select first_func ('aaa','bbb','ccc') +-- + | first_func ('aaa','bbb' 'ccc') | +-+ | 1 | +-+ 1 row in set (0.47 sec)
5. Delete function:
Mysql > drop function first_func; Query OK, 0 rows affected (0.11 sec)
VI. View function
1) show function status
Displays basic information about all functions in the database
2) View a specific function
Mysql > show create function function; Thank you for reading this article carefully. I hope it will be helpful for everyone to share the methods of creating functions in mysql. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!
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.