17.10 - Example: Using TD_NORMALIZE_OVERLAP - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Date and Time Functions and Expressions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1211-171K
Language
English (United States)
WITH subtbl(flight_id, duration) AS
   (SELECT flight_id, duration FROM FlightExp)
SELECT * 
FROM TABLE (TD_SYSFNLIB.TD_NORMALIZE_OVERLAP(NEW VARIANT_TYPE(subtbl.flight_id),
                                             subtbl.duration)
RETURNS (flight_id INT, duration PERIOD(TIMESTAMP(6) WITH TIME ZONE), NrmCount INT)
HASH BY flight_id     /* input data is redistributed on column, flight_id */
LOCAL ORDER BY flight_id, duration)     /* input data is sorted on these columns */
AS DT(flight_id, duration, NrmCount) ORDER BY 1,2;