SHOW CREATE FUNCTION
On this page
The SHOW CREATE FUNCTION command outputs configuration information about an existing user-defined function, including user-defined scalar value functions (UDFs) and user-defined table-valued functions (TVFs).
Syntax
SHOW CREATE FUNCTION { function_name | database_name.function_name } [WITH ID <variant ID>]
Remarks
-
Refer to the Permissions Matrix for the required permissions.
Example - SHOW CREATE FUNCTION
The following example shows the output of SHOW CREATE FUNCTION for the is_ UDF from CREATE FUNCTION (UDF).
SHOW CREATE FUNCTION is_prime\G
*** 1. row ***
Function: is_prime
sql_mode: STRICT_ALL_TABLES,NO_AUTO_CREATE_USER
Create Function: CREATE OR REPLACE FUNCTION `is_prime`(n bigint(20) NOT NULL) RETURNS bigint(20) NULL DEFINER = 'root'@'%' AS
BEGIN
IF n <= 1 THEN
RETURN FALSE;
END IF;
FOR i IN 2 .. (n-1) LOOP
EXIT WHEN i * i > n;
IF n % i != 0 THEN
CONTINUE;
END IF;
RETURN FALSE;
END LOOP;
RETURN TRUE;
END;
character_set_client: utf8mb4
collation_connection: utf8mb4_bin
1 row in set (0.00 sec)Example - SHOW CREATE FUNCTION for an Overloaded Function
The following example shows the output of SHOW CREATE FUNCTION for variant 1 of the print_ function from Overloaded Functions and Stored Procedures.
SHOW CREATE FUNCTION print_type WITH ID 1\G
*** 1. row ***
Function: print_type
sql_mode: STRICT_ALL_TABLES,NO_AUTO_CREATE_USER
Create Function: CREATE OR REPLACE FUNCTION `print_type`(input bigint(20) NULL) RETURNS text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFINER = 'root'@'%' AS
BEGIN
RETURN "Big Integer";
END;
character_set_client: utf8mb4
collation_connection: utf8mb4_binRelated Topics
Last modified: