Olá a todos,
estou com um problema num select:
sql = “Select sum(PESO_BRUTO - PESO_TARA) as PESO from OS_PESAGENS where COD_EMPRESA = ? and DT_MOV < ?”;
PreparedStatement psmt = conn.prepareStatement(sql);
psmt.clearParameters();
psmt.setString(1, unidade);
java.sql.Date date = null;
DateFormat formatter = new SimpleDateFormat(“dd/MM/yyyy”);
try {
date = new java.sql.Date(((java.util.Date) formatter.parse(Data)).getTime());
} catch (ParseException ex) {
Logger.getLogger(OracleAcesso.class.getName()).log(Level.SEVERE, null, ex);
}
psmt.setDate(2, date);
ResultSet rs = psmt.executeQuery();
O problema está no select,
se coloco DT_MOV < ?: da erro
se coloco DT_MOV = ?: retorna para a data normal.
ou seja,
só funciona com sinal de =. Se colocar >, <, <=, >= não funciona.