16.20 - Invoking a Window Aggregate UDF - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)

Once an aggregate UDF is defined, you can invoke it using a partition window.

Consider the following aggregate UDF definition:

REPLACE FUNCTION myUdoa(x FLOAT)
RETURNS FLOAT
CLASS AGGREGATE(250)
LANGUAGE JAVA
NO SQL
PARAMETER STYLE JAVA
EXTERNAL NAME 'INVF:AggregateFunctions.myUdoa(com.teradata.fnc.Phase,
   com.teradata.fnc.Context[],double) returns java.lang.Double';

You can invoke this aggregate UDF with the following query:

SELECT myUdoa(Product_ID) OVER() FROM tab_invf01102;