HomeMogDBMogDB StackUqbar
v5.0

Documentation:v5.0

Supported Versions:

Other Versions:

SHOW CREATE FUNCTION

Function

It returns the exact string that can be used to recreate the named function. A similar statement, SHOW CREATE PROCEDURE, displays information about stored functions.

To use either statement, you must have global SELECT privileges.

Precautions

sql_mode is the session value for the query. bDatabase shows here the sql_mode bound when the routine is created, MogDB shows here the session value because MogDB does not bind the routine to sql_mode when it creates the routine.

character_set_client is the session value of the system variable for client_encoding when the routine was created.

collation_connection is the value specified when lc_collate creates the database.

Database Collation is the value specified by lc_collate when it created the database.

Syntax

SHOW CREATE FUNCTION func_name

Parameter Description

  • func_name

    The function name.

Examples

-- Creating a function
MogDB=# CREATE FUNCTION functest_A_1(text, date) RETURNS bool LANGUAGE 'sql'
       AS 'SELECT $1 = ''abcd'' AND $2 > ''2001-01-01''';
CREATE FUNCTION
-- Query function creation statemen
MogDB=# show create function functest_A_1;
   Function   |                         Create Function                          |              sql_mode               | character_set_client | collation_connection 
| Database Collation 
--------------+------------------------------------------------------------------+-------------------------------------+----------------------+----------------------+--------------------
 functest_a_1 | CREATE OR REPLACE FUNCTION public.functest_a_1(text, date)      +| sql_mode_strict,sql_mode_full_group | UTF8                 | en_US.UTF-8          
| en_US.UTF-8
              |  RETURNS boolean                                                +|                                     |                      |                      
| 
              |  LANGUAGE sql                                                   +|                                     |                      |                      
| 
              |  NOT FENCED NOT SHIPPABLE                                       +|                                     |                      |                      
| 
              | AS $function$SELECT $1 = 'abcd' AND $2 > '2001-01-01'$function$;+|                                     |                      |                      
| 
              |                                                                  |                                     |                      |                      
| 
(1 row)
Copyright © 2011-2024 www.enmotech.com All rights reserved.