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

19 篇文章 4 订阅

转载自: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中的数据类型就可以了。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值