Example of interval_term / numeric_factor - Analytics Database - Teradata Vantage

SQL Date and Time Functions and Expressions

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
cpk1628111786971.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
pxz1544241488545
lifecycle
latest
Product Category
Teradata Vantageā„¢

The following example uses an interval_term value divided by a numeric_factor value.

SELECT INTERVAL '10-03' YEAR TO MONTH / 3;

The interval_term is INTERVAL '10-03' YEAR TO MONTH.

The numeric_factor is 3.

The processing involves the following stages:

  1. The interval value is decomposed into a value of months.

    Ten years and three months evaluate to 123 months.

  2. The interval total is divided by the numeric_factor 3, giving '3-05'.

The next example is similar to the first except that it shows how truncation is used in integer arithmetic.

SELECT INTERVAL '10-02' YEAR TO MONTH / 3;

The interval_term is INTERVAL '10-02' YEAR TO MONTH.

The numeric_factor is 3.

The processing involves the following stages:

  1. The interval value is decomposed into a value of months.

    Ten years and two months evaluate to 122 months.

  2. The interval total is divided by the numeric_factor 3, giving 40.67 months, which is truncated to 40 because the value is an integer.
  3. The interval total is converted back to the appropriate format, giving INTERVAL '3-04'.