17.10 - Examples: Distinguish between Multiple Candidate Columns - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - Time Series Tables and Operations

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1208-171K
Language
English (United States)

When there are multiple candidate columns that can be inferred to be the timecode column, the USING TIMECODE clause provides a way to disambiguate which to use; for example, when there are joins between PTI tables. If the USING TIMECODE clause is not specified in ambiguous cases, an error is reported.

Example: USING TIMECODE Clause with Multiple Candidate Columns

The example shows explicitly specifying the USING TIMECODE clause in a join:

select avg(b.temperature)
from ocean_buoys_seq a , ocean_buoys_seq b
group by time(minutes(100))
using timecode(a.td_timecode); 

Example: Invalid Example with Ambiguous Multiple Candidate Columns

The example shows that the timecode is ambiguous without specifying the USING TIMECODE clause in this join:

select avg(a.temperature)
from ocean_buoys_seq a, ocean_buoys b
group by time(minutes(100));

 *** Failure 4359 Time Series: Timecode specification is ambiguous.