I have a query which obtains data of type NUMBER in the BD, what I do is show the result of the query in a .csv file and at the time of showing that data the fields of type NUMBER which are (IMPORTE_UNO, IMPORTE_DOS)
it does not show decimals, for that I made use of to_char
My query is this
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'), F.ENTIDAD_REC
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')
Those fields are defined like this in the BD
IMPORTE_UNO NUMBER(12,2)
IMPORTE_DOS NUMBER(16,2)
What I do not know and I would like to clarify, is that if the way I use the TO_CHAR(F.IMPORTE_DOS,'fm9990.00')
is ok or should go 12 times the "9" on the left because that field is defined IMPORTE_UNO NUMBER(12,2)
, I do not know much about Oracle and I do not know if it's correct, which means NUMBER (12,2) ??
In my java code those fields are mapped as Double