17.10 - Example - 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)

Consider the following employee table, where the column eduration is defined as a PERIOD(DATE) data type:

ename               eid  eduration
----------  -----------  ------------------------
Adams            210677  ('05/03/01', '06/05/21')
Gunther          199347  ('04/06/06', '99/12/31')
Montoya          199340  ('04/06/02', '99/12/31')
Chan             210427  ('04/09/24', '99/12/31')
Fuller           197899  ('03/05/27', '03/11/30')

The following SQL query uses IS UNTIL_CHANGED to compare the ending bound value of the eduration column to UNTIL_CHANGED:

SELECT ename, eid
FROM employee
WHERE END(eduration) IS UNTIL_CHANGED;

The result is:

ename               eid
----------  -----------
Gunther          199347
Montoya          199340
Chan             210427