DECIMAL and NUMERIC.
The recommended Java mapping for the DECIMAL and NUMERIC types is
java.math.BigDecimal. The java.math.BigDecimal type provides math
operations to allow BigDecimal types to be added, subtracted,
multiplied, and divided with other BigDecimal types, with integer
types, and with floating point types.
The method recommended for retrieving DECIMAL and NUMERIC values is
ResultSet.getBigDecimal. JDBC also allows access to these SQL types
as simple Strings or arrays of char. Thus, Java programmers can use
getString to receive a DECIMAL or NUMERIC result. However, this makes
the common case where DECIMAL or NUMERIC are used for currency values rather awkward, since it means that application writers have to
perform math on strings. It is also possible to retrieve these SQL
types as any of the Java numeric types.
Have a look here for further details.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…