Example: interval_term / numeric_factor - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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 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'.