What Java data type corresponds to Oracle SQL data type numeric?

Oracle jdbc driver assigns Java data type to Oracle SQL data type numeric? Does this vary with the size of the numeric type?

Solution

As others have said, the driver maps everything to BigDecimal, even if it is defined as number (38) (which can be mapped to BigInteger)

But it's easy to find out what the driver mapping is Just execute GetObject () on the column of resultset and view the class generated by the driver

It's 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());
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>