MySQL functions have exactly one return value.
One, create syntax
create function function name (parameter list) returns return type
begin
function body
end
The parameter list consists of two parts:
parameter name parameter type
2. Calling syntax
select function name (parameter list)
3. Example
Definition:
Call:
Errors may occur during the definition process:
ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you might want to use the less safe log_bin_trust_function_creators variable)
At this time, it can be solved by setting the value of the variable log_bin_trust_function_creators to 1:
set global log_bin_trust_function_creators=1;