Example: 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

This example uses a numeric_factor with an INTERVAL YEAR TO MONTH typed value.

SELECT INTERVAL '10-02' YEAR TO MONTH * 12/5;

The numeric_factor in this operation is the integer 12.

The processing involves the following stages:

  1. The interval is multiplied by 12, giving the result as an interval.
  2. The interval result is divided by 5, giving '24-04'.

Using parentheses to change the order of evaluation returns different results. For example:

SELECT INTERVAL '10-02' YEAR TO MONTH * (12/5);

The numeric_factor in this operation is (12/5).

The processing involves the following stages:
  1. The numeric_factor is computed, giving the result 2.4, which is truncated to 2 because the value is an integer by default.
  2. The interval is multiplied by 2, giving '20-04'.