Hi fhussain,
how about something along these lines:
select
substr(cast( 1000*OUTSTANDINGBAL as bigint ) , 1, length( cast( 1000*OUTSTANDINGBAL as bigint ) -3) || ',' ||
substr(cast( 1000*OUTSTANDINGBAL as bigint ) , length( cast( 1000*OUTSTANDINGBAL as bigint ) -2, 3)
from CREDITTable
Didn't check for syntax, but you may get the idea anyway.
Johann
Quote:
Originally posted by fhussain
I am trying to cast a Decimal datatype to Varchar using
SELECT cast(char (OUTSTANDINGBAL) as varchar (30))
FROM CREDITTable;
and i get the results as
000000000000012.250
Decimal data type is defined as decimal(18,3) on the CREDITTable.
I need to avoid the leading zeros and get the 12.250 to insert into anothe table.
Is there any way I can do this?
I looked through most of the functions db2 has but it didn't get me anywhere.
I would really apprecaite it if you could forward any examples...
thanks
faris
|