error when consulting data

0

Hi, I am doing a query to a database but I have a problem when it returns the result, in the table of the database to which I ask the query there is data that starts with this value 00060306.1000 but when doing the consultation I returned this 636.1 that is, I'm removing the zeros

This is the part where I'm doing that

    public ParameterTable getCatalogoST(List<Map<String, Object>> listexecute){
   ParameterTable catalogoST = new ParameterTable(Arrays.asList(new String[] {"descripcionContocur"}));
   Iterator<Map<String, Object>> iterador = listexecute.iterator();

   while(iterador.hasNext()){
       Map<String, Object> newRow = new HashMap<String, Object>();
       newRow.put("descripcionContocur",iterador.next().get("MC04_CONTOCUR").toString().trim());//:::::::::::::::::::::::::::::::::::::::::::
       catalogoST.add(newRow);
       //LOGGER.info("### resultado  [" +catalogoST+ "]");////////prueba
   }

   return catalogoST;
}
    
asked by PanchoVilla 03.08.2018 в 23:13
source

1 answer

0

The data must be of a decimal type in the database and what returns to you is totally valid, zeros to the left are not valid. What you can do is fill in zeros the ones you need with a format.

NumberFormat formatter = new DecimalFormat("00000000.0000")
formatter.format(mi_decimal)
    
answered by 04.08.2018 в 15:36