PDF (A4) - 35.2Mb
Man Pages (TGZ) - 256.4Kb
Man Pages (Zip) - 361.2Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
MySQL and Linux/Unix
MySQL and macOS
MySQL Partitioning
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL Restrictions and Limitations
Security in MySQL
MySQL and Solaris
Building MySQL from Source
Starting and Stopping MySQL
MySQL Tutorial
MySQL and Windows
MySQL NDB Cluster 7.5
CREATE [AGGREGATE] FUNCTIONfunction_name RETURNS {STRING|INTEGER|REAL|DECIMAL} SONAMEshared_library_name This statement loads the loadable function namedfunction_name. (CREATE FUNCTION is also used to created stored functions; seeSection 13.1.16, “CREATE PROCEDURE and CREATE FUNCTION Statements”.)
A loadable function is a way to extend MySQL with a new function that works like a native (built-in) MySQL function such asABS() orCONCAT(). SeeAdding a Loadable Function.
function_name is the name that should be used in SQL statements to invoke the function. TheRETURNS clause indicates the type of the function's return value.DECIMAL is a legal value afterRETURNS, but currentlyDECIMAL functions return string values and should be written likeSTRING functions.
TheAGGREGATE keyword, if given, signifies that the function is an aggregate (group) function. An aggregate function works exactly like a native MySQL aggregate function such asSUM() orCOUNT().
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 theplugin_dir system variable. For more information, seeSection 5.6.1, “Installing and Uninstalling Loadable Functions”.
CREATE FUNCTION requires theINSERT privilege for themysql system database because it adds a row to themysql.func system table to register the function.
During the normal startup sequence, the server loads functions registered in themysql.func table. If the server is started with the--skip-grant-tables option, functions registered in the table are not loaded and are unavailable.
To upgrade the shared library associated with a loadable function, issue aDROP FUNCTION statement, upgrade the shared library, and then issue aCREATE FUNCTION statement. If you upgrade the shared library first and then useDROP FUNCTION, the server may unexpectedly shut down.
PDF (A4) - 35.2Mb
Man Pages (TGZ) - 256.4Kb
Man Pages (Zip) - 361.2Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
MySQL and Linux/Unix
MySQL and macOS
MySQL Partitioning
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL Restrictions and Limitations
Security in MySQL
MySQL and Solaris
Building MySQL from Source
Starting and Stopping MySQL
MySQL Tutorial
MySQL and Windows
MySQL NDB Cluster 7.5