1.0

Table Of Contents
DECIMAL
Provides an exact decimal value having a specied precision and scale. The precision is the total number of
digits both to the left and the right of the decimal point, and the scale is the number of digits in the fraction to
the right of the decimal point.
A numeric value (e.g. INT, BIGINT, SMALLINT) can be put into a DECIMAL as long as non-fractional precision
is not lost else a range exception is thrown (SQLState: 22003). When truncating trailing digits from a DECIMAL,
the value is rounded down.
For behavior with other types in expressions, see Numeric type promotion in expressions, Scale for decimal
arithmetic and Storing values of one numeric data type in columns of another numeric data type.
java.math.BigDecimalEquivalent Java type
1 to 31Precision min/max
less than or equal to precisionScale min/max
5Default precision
0Default scale
java.sql.Types.DECIMALJDBC metadata type
ResultSet.getBigDecimal, PreparedStatement.setBigDecimalJDBC methods
System.DecimalEquivalent .NET type
Vmware.Data.SQLFire.SQLFType.DecimalADO.NET metadata type
DecimalADO.NET mapped System.Data.Dbtype
DbDataReader.GetDecimalADO.NET getter
Syntax in CREATE TABLE
{ DECIMAL | DEC } [(precision [, scale ])]
Example
-- this cast loses fractional precision
values cast (23.8372 AS decimal(4,1));
-- results in:
23.8
-- this cast is outside the range
values cast (97824 AS decimal(4,1));
-- throws exception:
ERROR 22003: The resulting value is outside the range for the data type
DECIMAL/NUMERIC(4,1).
DOUBLE
Provides 8-byte storage for numbers using IEEE oating-point notation.
Arithmetic operations do not round their resulting values to zero. If the values are too small, you will receive an
exception. Numeric oating point constants are limited to a length of 30 characters.
For behavior with other types in expressions, see Numeric type promotion in expressions, and Storing values of
one numeric data type in columns of another numeric data type.
577
SQL Language Reference