skip to main content
Basic elements of SQL : Working with Numeric and Decimal data types : NUMERIC data type
 

NUMERIC data type

In NUMERIC data type, precision (P) is the number of digits in a number, and scale (S) is the number of digits to the right of the decimal point in a number. For example, the number 123.45 has a precision of 5 and a scale of 2.
Length (L) for a numeric data type is the number of bytes that are used to store the number.
In OpenAccess SDK, the default maximum precision of a numeric data type is 127, and the scale varies between zero and precision (0 <= S <= P).
Maximum precision (P) is 127
Maximum scale (S) is 127
Mantissa (M = P - S) can range from 0 to 124
The following examples describe valid and invalid numeric ranges for NUMERIC (P, S):
Valid Numeric ranges
NUMERIC (127, 127) --> P = 127, S = 127, M = 0
NUMERIC (127, 3) --> P = 127, S = 3, M = 124
NUMERIC (124, 0) --> P = 124, S = 0, M = 124
Invalid Numeric ranges
NUMERIC (127, 0/1/2) --> P = 127, S = 0/1/2, M = 127/126/125
NUMERIC (126, 0/1) --> P = 126, S = 0/1, M = 126/125
NUMERIC (125, 0) --> P = 125, S = 0, M = 125