17.00 - Example: SHOW FUNCTION (SQL Form) - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Release Date
September 2020
Content Type
Programming Reference
Publication ID
B035-1144-170K
Language
English (United States)

SHOW FUNCTION (SQL Form) requests display the DDL create text for the SQL UDF. The output displayed by a SHOW FUNCTION request returns the actual create text that was used to create the SQL UDF and does not return the default values for some of the optional clauses that were not specified explicitly during the creation of the SQL UDF.

     SHOW SPECIFIC FUNCTION udf_1;
     CREATE FUNCTION udf_1 (a INTEGER, 
                            b INTEGER)
     RETURNS INTEGER
     CONTAINS SQL
     RETURN a + b;

Note that the output of this example does not display the default values for some options like the LANGUAGE clause, DETERMINISTIC clause, the null call clause, and so on because the creator of udf1 did not type these clauses explicitly when she created the SQL UDF, so the SHOW FUNCTION request does not return the default values for those clauses.

In the following example, the SHOW FUNCTION request does return the default values for the LANGUAGE clause, the DETERMINISTIC clause, and the null call clause because the creator typed those clauses explicitly when he created udf_2.

     SHOW FUNCTION udf2 (INTEGER, INTEGER);
     CREATE FUNCTION udf2 (a INTEGER, b INTEGER)
     RETURNS INTEGER
     LANGUAGE SQL
     DETERMINISTIC
     CONTAINS SQL
     CALLED ON NULL INPUT
     RETURN a - b;