Name
SHOW CREATE FUNCTION
Synopsis
SHOW CREATE FUNCTION function
This 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')
Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.