Neoview SQL Reference Manual (R2.4 SP2)
Examples of Interval Literals
Interval of 1 month
INTERVAL '1' MONTH
Interval of 7 days
INTERVAL '7' DAY
Interval of 2 years, 7 months
INTERVAL '2-7' YEAR TO MONTH
Interval of 5 days, 2 hours, 15 minutes, and 36.33 seconds
INTERVAL '5:2:15:36.33' DAY TO SECOND(2)
Interval that subtracts 5 days
INTERVAL - '5' DAY
Interval of 100 days. This example requires an explicit
leading precision of 3 because the default is 2.
INTERVAL '100' DAY(3)
Interval of 364 days, 23 hours. The separator for the day
and hour fields can be a space or a colon.
INTERVAL '364 23' DAY(3) TO HOUR
Numeric Literals
A numeric literal represents a numeric value. Numeric literals can be represented as an exact
numeric literal (without an exponent) or as an approximate numeric literal by using scientific
notation (with an exponent).
exact-numeric-literal is:
[+|-]unsigned-integer[.[unsigned-integer]]
| [+|-].unsigned-integer
approximate-numeric-literal is:
mantissa{E|e}exponent
mantissa is:
exact-numeric-literal
exponent is:
[+|-]unsigned-integer
unsigned-integer is:
digit...
exact-numeric-literal
is an exact numeric value that includes an optional plus sign (+) or minus sign (-), up to 128
digits (0 through 9), and an optional period (.) that indicates a decimal point. Leading zeros
do not count toward the 128-digit limit; trailing zeros do.
A numeric literal without a sign is a positive number. An exact numeric literal that does not
include a decimal point is an integer. Every exact numeric literal has the data type NUMERIC
and the minimum precision required to represent its value.
approximate-numeric-literal
is an exact numeric literal followed by an exponent expressed as an uppercase E or lowercase
e followed by an optionally signed integer.
Numeric values expressed in scientific notation are treated as data type REAL if they include
no more than seven digits before the exponent, but treated as type DOUBLE PRECISION if
they include eight or more digits. Because of this factor, trailing zeros after a decimal can
sometimes increase the precision of a numeric literal used as a DOUBLE PRECISION value.
For example, if XYZ is a table that consists of one DOUBLE PRECISION column, the inserted
value:
INSERT INTO XYZ VALUES (1.00000000E-10)
has more precision than:
INSERT INTO XYZ VALUES (1.0E-10)
266 SQL Language Elements