请找到我的以下查询,select nvl(max(transaction_id),0) as transaction_id from exception_details;如果我通过我的jdbc代码执行上面的查询,它给了我java.sql.SQLException:无法转换为内部表示我的JDBC代码如下:p...

请找到我的以下查询,
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.
织梦狗教程
本文标题为:java.sql.SQLException:无法转换为内部表示异常


基础教程推荐
猜你喜欢
- Spring AOP中三种增强方式的示例详解 2023-02-10
- 实例详解Java调用第三方接口方法 2023-01-09
- 解决Lombok使用@Builder无法build父类属性的问题 2023-05-24
- SpringSecurity自定义登录成功处理 2023-05-13
- java+io+swing实现学生信息管理系统 2023-03-15
- Spring Boot中@Conditional注解介绍 2023-05-18
- Java实现无损Word转PDF的示例代码 2022-12-14
- Java日期时间类及计算详解 2023-03-15
- springboot实现学生管理系统 2023-03-15
- springboot2+es7使用RestHighLevelClient的示例代码 2023-02-10