Please find my request below.
select nvl(max(transaction_id),0) as transaction_id from exception_details;
If I fulfilled the above request through my jdbc code, it gives me java.sql.SQLException: Fail to convert to internal representation
my JDBC code as follows:
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);
}
}
}
and the data type for the transaction_id column in the table is NUMBER
source
share