Important

Helios features are now enabled during weekly update windows and are no longer directly tied to SingleStore engine releases. Refer to the release notes to view the latest features available in your Helios cluster.

SHOW CREATE FUNCTION

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

Example - SHOW CREATE FUNCTION

The following example shows the output of SHOW CREATE FUNCTION for the is_prime 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_type 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_bin

Last modified:

Was this article helpful?