Hello,
i am trying to call one sql procedure with two parameters from java.
the first parameter is In parameter, the second is OUT.
the return value of this java method should be this second parameter value.
the following is my java code:
protected String getNextRunNumber() {
String runnumber=null;
String sql = "{call APIX.FNC_SST_EXPORT.GET_NEXT_RUNNUMBER (?,?)}";
CallableStatement state = null;
try{
Connection con= getDatabaseConnection();
state = con.prepareCall(sql);
state.setString(1, m_appKeyExport);
state.registerOutParameter(2,Types.NUMERIC,0);
state.execute();
ResultSet resultR = (ResultSet)state.getObject(2);
while (resultR.next()) {
runnumber=resultR.getBigDecimal(1).toString();
}
}
catch (SQLException e){System.out.println("You can not get the export next run number properly");}
return runnumber;
}
i got error message like:
java.lang.ClassCastException: java.math.BigDecimal
As far as i knew, if the parameter is number or decimal, we should give also the paramer scale to the method: state.registerOutParameter(), but i still get this error message.
Please help me to solve this problem.
Thanks a lot.