SHOW CREATE FUNCTION

This MySQL statement displays an SQL statement that can be used to create a function like the one given.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

SHOW CREATE FUNCTION function

Explanation

This MySQL statement displays an SQL statement that can be used to create a function like the one given. It's useful for displaying the SQL statements that are performed by the function.

Examples

An example of this MySQL statement follows, showing a function that was created with the CREATE FUNCTION statement (see that page of our MySQL documentation):

SHOW CREATE FUNCTION date_reformatted G

*************************** 1. row ***************************
       Function: date_reformatted
       sql_mode:
Create Function: CREATE DEFINER=`root`@`localhost`
FUNCTION `date_reformatted`(new_date VARCHAR(12))
RETURNS date
SQL SECURITY INVOKER
COMMENT 'Converts a string date like ''Dec. 7, 2009'' to standard format.'
RETURN STR_TO_DATE(REPLACE(new_date, '.', ''), '%b %d, %Y')