NUMERIC and DECIMAL Data Types
NUMERIC data types are stored internally as
DOUBLE PRECISION, or 64-bit integer data types, depending on the precision and scale defined for a column definition that uses these types. To determine how a
NUMERIC value is actually stored in the database, use
isql to examine the column definition in the table. If
NUMERIC is reported, then data is actually being stored as a 64-bit integer.
NUMERIC value is stored as a
INTEGER, the value is stored as a whole number. During retrieval in DSQL, the
sqlscale field of the
XSQLVAR is set to a negative number that indicates the factor of ten by which the whole number (returned in
sqldata), must be divided in order to produce the correct
DECIMAL value with its fractional part. If
sqlscale is –1, then the number must be divided by 10, if it is –2, then the number must be divided by 100, –3 by 1,000, and so forth.