title: Issue with COALESCE in DB2 and Jasper Reports
body: <p>I am having a query wherein I am fetching out sum of a column from a table formed through sub query. </p>
  
  <p>Something in the lines:</p>
  
  <pre><code>select temp.mySum as MySum from (select sum(myColumn) from mySchema.myTable) temp;
  </code></pre>
  
  <p>However, I don't want MySum to be null when temp.mySum is null. Instead I want MySum to carry string 'value not available' when temp.mySum is null.</p>
  
  <p>Thus I tried to use coalesce in the below manner:</p>
  
  <pre><code>select coalesce(temp.mySum, 'value not available') as MySum from (select sum(myColumn) from mySchema.myTable) temp;
  </code></pre>
  
  <p>However above query is throwing error message:</p>
  
  <pre><code>Message: The data type, length or value of argument "2" of routine "SYSIBM.COALESCE" is incorrect.
  </code></pre>
  
  <p>This message is because of datatype incompatibility between argument 1 and 2 of coalesce function as mentioned in the first answer below.</p>
  
  <p>However, I am directly using this query in Jasper to send values to Excel sheet report:</p>
  
  <pre><code>hashmap.put("myQuery", this.myQuery);
  JasperReport jasperReportOne = JasperCompileManager.compileReport(this.reportJRXML);
  JasperPrint jasperPrintBranchCd = JasperFillManager.fillReport(jasperReportOne , hashmap, con);
  jprintList.add(jasperPrintOne);
  JRXlsExporter exporterXLS = new JRXlsExporter();
  exporterXLS.setParameter(JRExporterParameter.JASPER_PRINT_LIST, jprintList);
  exporterXLS.exportReport();
  </code></pre>
  
  <p>In the excel sheet, I am getting value as null when the value is not available. I want to show 'value unavailable' in the report. </p>
  
  <p>How could this be achieved ?</p>
  
  <p>Thanks for reading!</p>