DECIMAL Result Data Type - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

The result data type for binary arithmetic operations involving DECIMAL operands is as follows:

Left Operand Right Operand Operator Result Data Type
DATE DECIMAL(k,j) * / MOD DECIMAL(p,j)

These operations on DATE do not report an error, but results are rarely meaningful.

BYTEINT

SMALLINT

INTEGER

BIGINT

* / + - MOD DECIMAL(p,j)
DECIMAL(m,n) BYTEINT

SMALLINT

INTEGER

BIGINT

+ - * DECIMAL(p,n)
DATE * DECIMAL(p,n)

These operations on DATE do not report an error, but results are rarely meaningful.

In these cases, the value of p, the number of digits in the decimal result, depends on:
  • The number of digits in the decimal operand, where the number of digits is k for a DECIMAL(k,j) operand on the right side of the operator or m for a DECIMAL(m,n) operand on the left side of the operator.
Left Operand Right Operand Operator Result Data Type
DECIMAL(m,n) DECIMAL(k,j) + - DECIMAL(min(p, (1+max(n,j)+max(m -n,k -j))),max(n,j))
* DECIMAL(min(p,m +k),(n +j))
/ MOD DECIMAL(p,max(n,j))