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

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
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;