The leading zeroes before decimal point is missing in string formatting of decimal data in XML in db2 11.1 When generating XML that includes decimal values in  Db2 11.1, the leading zero right before the decimal point isremoved.

In the following query, the decimal value   .00000000000000 is published even it should come as 0.00000000000000 from the XMLELEMENT function.

SELECT XMLElement(
  NAME "keytable",
  XMLAGG(
    XMLELEMENT(
      NAME "tab", 
      XMLAttributes( interp as "interp")
    )
  ) OPTION null ON NULL
) 
FROM abc where wkstn_oid_sh = 100 AND wkstn_oid_lng = 4211"


The correct result should be :

&lt;KEYTABLE&gt;&lt;TAB INTERP="0.00000000000000"/&gt;&lt;TAB INTERP="0.00000000000000"/&gt; &lt;/KEYTABLE&gt;. 


But currently db2 returns : 

&lt;KEYTABLE&gt;&lt;TAB INTERP=".00000000000000"/&gt;&lt;TAB INTERP=".00000000000000"/&gt;&lt;/KEYTABLE&gt;.


How can I get it to format decimals as 0.00000000000000?
If your consumer is so sensitive to the number format and cannot interpret values without leading zeroes, you can format your numeric values explicitly:

...xmlattributes(varchar_format(interp,'S00.00000000') as "interp")