SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
N-13
Numeric Literals
Numeric Literals
A numeric literal represents a numeric value. Each numeric literal has the data type
NUMERIC and the minimum precision required to represent the value it specifies.
A simple numeric literal (one without an exponent) can include up to 18 digits (0
through 9), a plus sign (+) or a minus sign (–), and a period (.) that indicates a decimal
point. Leading zeros do not count toward the 18-digit limit; trailing zeros do.
A sign in a simple numeric literal must be the first character of the numeric literal. A
numeric literal without a sign is considered to be a positive number.
A simple numeric literal that does not include a decimal point is considered to be an
integer.
A numeric literal in scientific notation is a simple numeric literal followed by an
exponent expressed as the letter E or e followed by an optionally signed integer.
Numeric values expressed in scientific notation are handled as type REAL if they
include no more than seven digits before the exponent, but handled as type DOUBLE
PRECISION if they include eight or more digits. Because of this, 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:
INSERT INTO XYZ VALUES (1.00000000E-10);
is more precision than
INSERT INTO XYZ VALUES (1.0E-10);
Example—Numeric Literals
These are all numeric literals:
477 580.45 +005 -.3175 1300000000
99. -0.123456789012345678 99E-2