17.00 - Examples: Distinguish between Multiple Candidate Columns - Teradata Database

Teradata Vantageā„¢ - Time Series Tables and Operations

prodname
Advanced SQL Engine
Teradata Database
vrm_release
17.00
created_date
June 2020
category
Programming Reference
featnum
B035-1208-170K

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.