15.10 - Function Definition for Examples - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

Following is the UDF definition for “Example: Commenting on the Parameter Pattern of a UDF” and “Example: Commenting on the Definition of an External UDF”:

    CREATE FUNCTION find_text
         ( searched_string VARCHAR(500), pattern VARCHAR(500) )
         RETURNS CHAR
         LANGUAGE C
         NO SQL
         EXTERNAL 
         PARAMETER STYLE SQL;

Example: Commenting on the Parameter Pattern of a UDF

This statement places a comment on the parameter pattern of the UDF find_text :

    COMMENT ON COLUMN find_text.pattern 
    IS 'The pattern matching string';

Because the object kind for this request is COLUMN, you must specify the keyword COLUMN for the object kind when you code it.

Example: Commenting on the Definition of an External UDF

This statement places a comment on the definition of the external UDF find_text :

    COMMENT ON FUNCTION find_text
    IS 'Text search function';

Because the object kind for this request is FUNCTION, you must specify the keyword FUNCTION for the object kind when you code it.

Example: Commenting on an SQL Function

This statement defines a comment on the SQL function SpecificUDF1. Note that you must specify a specific UDF name.

     COMMENT ON FUNCTION SpecificUDF1 
     AS 'This is an SQL user-defined function';

Because the object kind for this request is FUNCTION, you must specify the keyword FUNCTION for the object kind when you code it.