title: DB2 : Length of concatenated fields different
body: <p>Below query gives 2 different wrong length but same numbers ,In IBM db2 SQL
  Why there is 2 different length for same value ?</p>
  
  <pre><code>select 
    decimal(TRIM(cast(15 as char(2)))||TRIM(LPAD(cast(7 as   char(2)),2,'0'))||TRIM(LPAD(cast(13 as char(2)),2,'0'))),
    length(decimal(TRIM(cast(15 as char(2)))||TRIM(LPAD(cast(7 as char(2)),2,'0'))||TRIM(LPAD(cast(13 as char(2)),2,'0')))),
    decimal(TRIM(substr(replace(char(current_date -1 days,ISO),'-',''),3,6)),6,0),
    length(decimal(TRIM(substr(replace(char(current_date -1 days,ISO),'-',''),3,6)),6,0))
  from sysibm.sysdummy1
  </code></pre>