What Java data type does the Oracle JDBC driver assign to the Oracle SQL data type NUMERIC
? Does this vary with the size of the NUMERIC
type?
As others have already said: the driver maps everything to BigDecimal, even if it's defined as NUMBER(38) (which could be mapped to BigInteger)
But it's pretty easy to find out what the driver maps. Simply do a getObject() on the column of the ResultSet and see which class the driver generated.
Something like:
ResultSet rs = statement.executeQuery("select the_number_column from the_table"); if (rs.next()) { Object o = rs.getObject(1); System.out.println("Class: " + o.getClass().getName()); }