Example Query - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantage™

Consider the following table definition and data:

CREATE TABLE Product_Life (Product_ID INTEGER,
                           Product_class VARCHAR(30), HOURS FLOAT);

INSERT INTO Product_Life VALUES (100, 'Bulbs', 100);
INSERT INTO Product_Life VALUES (100, 'Bulbs', 200);
INSERT INTO Product_Life VALUES (100, 'Bulbs', 300);

The following query uses the Java method that represents intermediate aggregate results as an object:

SELECT Product_ID, SUM(Hours), STD_DEV_OBJ(Hours)
FROM Product_Life
WHERE Product_Class = 'Bulbs'
GROUP BY Product_ID;

The following query uses the Java method that represents intermediate aggregate results as a byte array:

SELECT Product_ID, SUM(Hours), STD_DEV_BYTE(Hours)
FROM Product_Life
WHERE Product_Class = 'Bulbs'
GROUP BY Product_ID;