Please tell me how to return two values in java
Code:
public byte isFirstvalue(String A,
String B, String C, Date date) throws Exception {
CallableStatement cs = null;
Connection connection = null;
ResultSet rsResult = null;
byte isFirstvalue= -1;
byte isSecondvalue = -1;
try {
connection = getConnection();
cs = connection.prepareCall("{ call IsProc(?,?,?,?) }");
cs.setString(1, A);
cs.setString(2, B);
cs.setString(3, C);
cs.setDate(4, date);
rsResult = cs.executeQuery();
if(rsResult.next()){
isFirstvalue= rsResult.getByte("IsFirstvalue");
isSecondValue = rsResult.getByte("IsSecondValue ");
}
}
catch (Exception ex) {
String errorMessage = ex.getMessage();
log.error(errorMessage);
throw ex;
}
finally {
closeResultSet(rsResult);
closeStatement(cs);
closeConnection(connection);
}
return isFirstValue ;
return isSecondValue
}
Comment