SHOW CREATE FUNCTION
SHOW CREATE FUNCTION functionThis 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.
Here is an example of a function that was created with the CREATE FUNCTION statement earlier in this chapter:
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, 2007'' to standard format.'
RETURN STR_TO_DATE(REPLACE(new_date, '.', ''), '%b %d, %Y')