Decimal Literals - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
tpf1598412463935.ditamap
dita:ditavalPath
tpf1598412463935.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantageā„¢

Declares literal strings of decimal numbers in an expression.

Syntax

[ + | - ] { n. | .n | n.n | n }

Syntax Elements

+, -
An optional sign.
The default is +.
n
Any valid integer.

Components of Decimal Literals

Decimal literals consist of the following components, reading from left-to-right:
  1. Optional sign
  2. Sequence of digits (including none)
  3. Decimal point
  4. Optional sequence of digits.

Spaces and new line characters are not allowed in a literal except after the optional sign.

Decimal Literal Data Types

Decimal literals include the following types:
  • DECIMAL
  • NUMERIC

Scale and Precision

The total number of digits in a decimal literal determine the precision and the number of digits to the right of the decimal point determine the scale. Leading and trailing zeros are included in the counts. The precision cannot exceed 38.

A numeric literal that is outside the range of the INTEGER type is assigned to DECIMAL(n, 0), where n is the number of digits in the literal, excluding leading zeros.

Examples: Decimal Literals

The following numbers are examples of decimal literals.

3.14159
253.
-88.234
.29
2147483650

Related Information

For information on DECIMAL data types, see DECIMAL/NUMERIC Data Types.