To prevent the mid-process output produced by semicolons, define a separator. The following is an official MySQL example: Use two dollar signs $ as the separator. The following sectionCodeIt is to create a prototype of a user-defined MySQL function, which can be modified on this basis, so that the creation of the 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 $ -- okay, this is the end.