6.3.2 Description format of literals
The following table lists the description formats and assumed data types of literals.
No. |
Type of literal |
Description format |
Assumed data type |
|
---|---|---|---|---|
1 |
Numeric literal |
Integer literal |
|
INTEGER |
2 |
Decimal literal |
|
DECIMAL(m[,n]) m,n: Number of specified digits |
|
3 |
Floating-point numeric literal |
|
DOUBLE PRECISION |
|
4 |
General literal |
Character string literal |
|
(where n indicates the length of the character string) |
5 |
Date literal |
|
DATE |
|
6 |
Time literal |
|
TIME[(p)] p: fractional seconds precision |
|
7 |
Time stamp literal |
|
TIMESTAMP[(p)] p: fractional seconds precision |
|
8 |
Hexadecimal-format binary literal |
|
(where n indicates the length of the hexadecimal character string) |
|
9 |
Binary-format binary literal |
|
(where n indicates the length of the binary character string) |
The following table shows restrictions on the use of numeric literals.
No. |
Numeric literal |
Range |
Maximum number of digits (including leading zeros) |
---|---|---|---|
1 |
Integer literal#1 |
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
19 digits |
2 |
Decimal literal |
-(1038 - 1) to -10-38, 0, and 10-38 to (1038 - 1) |
38 digits |
3 |
Floating-point numeric literal#2 |
Approximately -1.7 × 10308 to -2.3 × 10-308, 0, and approximately 2.3 × 10-308 to 1.7 × 10308 |
Mantissa part: 17 digits Exponent part: 3 digits |
- #1
-
If a literal that exceeds the range of values for an integer literal is written in the notation used to represent integer literals, it will be interpreted as a decimal literal, with an assumed decimal point to the right of the literal.
- #2
-
The exact range of values depends on the hardware representation.