Boa tarde gente, estou com um problema com query jbdc:
try{
this.connection = ConnectionFactory.getConnection();
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("select sum(valor) from refeicao where TO_DAYS(NOW()) - TO_DAYS(data_refeicao) <= 7 and id_usuario = " + user.getId_usuario()+ "");
while(rs.next()){
user = new Usuario();
user.setValor_refeicao(rs.getInt("sum(valor)"));
System.out.println("sum(valor): " + user.getValor_refeicao());
}
rs.close();
stmt.close();
this.connection.close();
}catch(SQLException e){
throw new DAOException("Erro ao selecionar contato. ", e);
}
Faço o select normalmente, só que tem um problema, não retorna o valor correto, por exemplo:
Se a soma der 5.30, nao aparece 5.30 apenas 5.00, ele arredonda, so que eu preciso do valor certo.
Se alguem puder me ajudar, agradeço.
