Example - Teradata Vantage - Analytics Database

SQL Data Types and Literals

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-11-06
dita:mapPath
uds1628112204571.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
exs1472253032394
lifecycle
latest
Product Category
Teradata Vantageā„¢

Assume that the current date is DATE '2008-05-14' at time zone displacement, INTERVAL '9:00' HOUR TO MINUTE, but the current date is DATE '2008-05-13' at time zone displacement, INTERVAL '04:00' HOUR TO MINUTE. The following SELECT statement returns the result: TIMESTAMP '2008-05-13 13:30:00'.

SET TIME ZONE INTERVAL '09:00' HOUR TO MINUTE;
SELECT CAST(TIME '08:30:00+04:00' AS TIMESTAMP(0) 
   AT SOURCE TIME ZONE);

The time zone displacement, INTERVAL '04:00' HOUR TO MINUTE, in the literal is used to determine the UTC value '04:30:00' and time zone displacement, INTERVAL '04:00' HOUR TO MINUTE, of the literal. For the CAST, the source expression value '04:30:00' at UTC is adjusted to the time zone displacement of the source, INTERVAL '04:00' HOUR TO MINUTE, to yield '08:30:00'.

A timestamp is formed from the current date '2008-05-13' at time zone displacement, INTERVAL '04:00' HOUR TO MINUTE, and the time portion of the source expression value '08:30:00' obtained after the time zone displacement adjustment. Then this timestamp '2008-05-13 08:30:00' at time zone displacement, INTERVAL '04:00' HOUR TO MINUTE, is adjusted to UTC so that the CAST result is '2008-05-13 04:30:00' at UTC.

The result value of the CAST at UTC is adjusted to the current session time zone displacement, INTERVAL '09:00' HOUR TO MINUTE, so the result of the SELECT statement is: TIMESTAMP '2008-05-13 13:30:00'.