Example Query - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
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;