CREATE [AGGREGATE] FUNCTION [IF NOT EXISTS] function_name
This statement loads the loadable function named
FUNCTION is also used to created stored functions; see
Section 15.1.17, “CREATE PROCEDURE and CREATE FUNCTION Statements”.)
function_name is the name that should
be used in SQL statements to invoke the function. The
RETURNS clause indicates the type of the
function's return value.
DECIMAL is a legal
RETURNS, but currently
DECIMAL functions return string values and
should be written like
IF NOT EXISTS prevents an error from
occurring if there already exists a loadable function with the
same name. It does not prevent an error
from occurring if there already exists a built-in function
having the same name.
IF NOT EXISTS is also
CREATE FUNCTION statements. See
Function Name Resolution.
shared_library_name is the base name
of the shared library file containing the code that implements
the function. The file must be located in the plugin directory.
This directory is given by the value of the
plugin_dir system variable. For
more information, see Section 7.7.1, “Installing and Uninstalling Loadable Functions”.
FUNCTION also adds the function to the Performance
that provides runtime information about installed loadable
Section 126.96.36.199, “The user_defined_functions Table”.
mysql.func system table, the
lists loadable functions installed using
FUNCTION. Unlike the
table also lists loadable functions installed automatically by
server components or plugins. This difference makes
mysql.func for checking which loadable
functions are installed.
During the normal startup sequence, the server loads functions
registered in the
mysql.func table. If the
server is started with the
functions registered in the table are not loaded and are