mybatis项目报java.sql.SQLException: Numeric Overflow的异常

转载自:http://www.easytd.com/yichangjijin/d_1411081846.html

项目报java.sql.SQLException: Numeric Overflow的异常,数据库oracle,使用的mybatis异常信息如下:

java.sql.SQLException: Numeric Overflow

; uncategorized SQLException for SQL []; SQL state [99999]; error code [17026]; Numeric Overflow; nested exception is java.sql.SQLException: Numeric Overflow

从下面了解到信息:

http://www.coderanch.com/t/610303/JDBC/databases/SQL-state-error-code-Numeric

This is just a guess, but it looks like you're trying to fetch a value from a ResultSet which doesn't fit into the chosen type in Java. Oracle can store numbers with up to 38 digits (disregarding the scale for now), which far exceeds even the range of Java's long datatype. Inspect the values you're trying to select from Oracle to see whether they don't contain some really large values. 

也就是说oracle中的数字可能会大过java中long类型的数字,建议使用BigInteger or BigDecimal。

  在我当前项目是因为项目中用的是short类型,而数据库中的数据达到了37000多,于是就溢出了。解决方法更改java中的数据类型就可以了。

你可能感兴趣的:(java,mybatis)