Examples: Distinguish between Multiple Candidate Columns - Analytics Database - Teradata Vantage

Time Series Tables and Operations

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-10-30
dita:mapPath
tuc1628112453431.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
sfz1493079039055
lifecycle
latest
Product Category
Teradata Vantageā„¢

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));

Result:

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