To prevent the mid-process output produced by semicolons, define a separator. Here, we use the mysql official example: Use two dollar signs $ as the separator, the following code is used to create a prototype of a user-defined mysql function. You can modify it on this basis so that the creation of a function will not produce many errors.
Set global log_bin_trust_function_creators = 1; -- enable bin_log copy function Creation
Drop function if exists hello; -- delete an existing
DELIMITER $ -- defines the DELIMITER, which must be available, but not $
Create function hello (s varchar (30) -- used for multiple parameters. The split parameter must be of the mysql column type.
Returns varchar (255) -- specifies the return value type. If you are not sure about the length of the returned text, you can use text
BEGIN
DECLARE str varchar (255) default 'hello'; -- defines a variable and specifies the default value.
SET str = concat (str, s); -- SET the value of the edge variable.
RETURN str; -- RETURN Value
END $ -- note that the end contains the separator defined earlier.
DELIMITER $ -- good, it's over.