I have a query which gets Date fields and fields type number
The result of this query is placed in an excel file and what it does is that it does NOT show the date fields in DD / MM / YYYY format and it does not show the number type fields with decimals, try to convert them with to_char
but when you show them in the excel the fields "null"
SELECT F.ID, F.NOMBRE, TO_CHAR(F.FECHA_INI,'DD/MM/YYYY'), TO_CHAR(F.FECHA_REGISTRO,'DD/MM/YYYY'), TO_CHAR(F.FECHA.CARGA,'DD/MM/YYYY'), TO_CHAR(F.IMPORTE_UNO,'fm9990.00'), TO_CHAR(F.IMPORTE_DOS,'fm9990.00')
FROM FACTURA F
WHERE (?1 IS NULL OR F.ID =?1)
AND F.FECHA_INI >= TO_DATE(?2 'DD/MM/YYYY')
AND F.FECHA_INI <= TO_DATE(?3 'DD/MM/YYYY')
Why do they come out null when showing them in the document?
What makes me fata or is it wrong?
I also tried TO_DATE
for the date and sample null
This is the code of the method you used to download the file with the query
if(factList !=null) {
response.addHeader("Content-Type", "application/csv");
response.addHeader("Content-Disposition", "attachment;filename=archivo.csv");
PrintWriter out = response.getWriter();
out.write("columna1,columna2,columna3");
out.write("\n");
for(String factu: factList){
out.write(factu.toCSVRepresentation());
out.write("\n");
}
out.flush();
out.close();
}else{
log.info("Esta vacio");
}
}catch(ControlException e){ throw new ControlException("Error", e); } }