1. Check whether the function can be created
show variables like '%fun%';
If it is OFF, it means that the function cannot be created
2. Modify the database and the function can be created
set global log_bin_trust_function_creators = 1;
In this way, change it to ON and you can create a function
3. Create a function (the mechanism is similar to creating a stored procedure)
create function fun_add(a int,b int) returns int begin return a+b; end; $$;
4. Call fun_add function
select fun_add(2,3);
5. Delete function
drop function if exists fun_add;
6. View function
show create function fun_add;
The above is the content of MySQL Advanced Six - Function Creation and Use. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!