Aggregate UDF | SQL Operators & User-Defined Functions | Teradata Vantage - 17.10 - Aggregate UDF - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Operators and User-Defined Functions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Administration
Programming Reference
Publication ID
B035-1210-171K
Language
English (United States)

Takes grouped sets of relational data, makes a pass over each group, and returns one result for the group.

ANSI Compliance

This statement is ANSI SQL:2011 compliant, but includes non-ANSI Teradata extensions.

The requirement that parentheses appear when the argument list is empty is a Teradata extension to preserve compatibility with existing applications.

The RETURNS data_type or RETURNS STYLE clauses are Teradata extensions to the ANSI SQL standard.

Required Privileges

You must have EXECUTE FUNCTION privileges on the function or on the database containing the function.

To invoke an aggregate UDF that takes a UDT argument or returns a UDT, you must have the UDTUSAGE privilege on the SYSUDTLIB database or on the specified UDT.

Syntax

udf_name ( [ argument [,...] ] )

For UDFs that are defined with parameters of TD_ANYTYPE data type:

( udf_name
  { () RETURNS { data_type | STYLE column_expr } |

    ( argument [,...] )
      [ RETURNS { data_type | STYLE column_expr } ]
  }
)

Syntax Elements

udf_name
The name of the aggregate UDF.
argument
A valid SQL expression. See Usage Notes for rules that apply to aggregate UDF arguments.
data_type
The desired return type of the TD_ANYTYPE result parameter.
column_expr
A table or a view column reference that determines the return type of the TD_ANYTYPE result parameter.