请找到我的以下查询,
select nvl(max(transaction_id),0) as transaction_id from exception_details;
如果我通过我的jdbc代码执行上面的查询,它给了我java.sql.SQLException:无法转换为内部表示
我的JDBC代码如下:
public int fetchColumnVal(String query) throws SQLException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException, ClassNotFoundException, InstantiationException {
PreparedStatement pstmt = null;
Connection con = null;
try {
con = getConnection(true);
pstmt = con.prepareStatement(query);
ResultSet rs = pstmt.executeQuery();
rs.next();
int count=rs.getInt(1);
return count;
} finally {
if (isBatchMode) {
this.cleanResources(null, pstmt);
}
else {
this.cleanResources(con, pstmt);
}
}
}
并且表中的transaction_id列的数据类型是NUMBER
解决方法:
如果你使用@Enumerated而没有定义EnumType.STRING,即
@Enumerated(EnumType.STRING)
并且您的表已经包含String数据(Varchar),您将收到此错误,cos.
默认EnumType是ORDINAL,即EnumType.ORDINAL.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。