Example of 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™

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

Note that very different results are obtained by using parentheses to change the order of evaluation as follows.

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