473,507 Members | 9,962 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert a decimal number into character

hi ,
I have a column with datatype as decimal(31,2) . The data is like
123456.67 , 7634578.99
Is it a way to convert the entire number into character . like
'1232456.67' .

The output should not be like as below :
db2 =select char(decimal(BAL_PRINCIPAL,31,2)) from
BIKASHK.RPT_BA_PAD331 where
integer(Bal_principal)!=0

1
---------------------------------
00000000000000000000010025000.00
00000000000000000000010025000.00
00000000000000000000010025000.00
00000000000000000000010025000.00

4 record(s) selected.

Rather It should be

10025000.00
10025000.00
10025000.00
10025000.00

For the above 4 rows and it should be 'char' in data type.

Appreciate your help .
Best Regards
Bikash Karan
Jun 27 '08 #1
2 15346
ka*********@gmail.com wrote:
hi ,
I have a column with datatype as decimal(31,2) . The data is like
123456.67 , 7634578.99
Is it a way to convert the entire number into character . like
'1232456.67' .

The output should not be like as below :
db2 =select char(decimal(BAL_PRINCIPAL,31,2)) from
BIKASHK.RPT_BA_PAD331 where
integer(Bal_principal)!=0

1
---------------------------------
00000000000000000000010025000.00
00000000000000000000010025000.00
00000000000000000000010025000.00
00000000000000000000010025000.00

4 record(s) selected.

Rather It should be

10025000.00
10025000.00
10025000.00
10025000.00

For the above 4 rows and it should be 'char' in data type.
Just LTRIM or STRIP the leading 0s

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 27 '08 #2
On May 7, 5:34*pm, Serge Rielau <srie...@ca.ibm.comwrote:
karanbik...@gmail.com wrote:
hi ,
I have a column with datatype as decimal(31,2) . The data is like
123456.67 *, 7634578.99
Is it a way to convert the entire number into character . like
'1232456.67' * * .
The output should not be like as below :
db2 =select char(decimal(BAL_PRINCIPAL,31,2)) from
BIKASHK.RPT_BA_PAD331 where
*integer(Bal_principal)!=0
1
---------------------------------
00000000000000000000010025000.00
00000000000000000000010025000.00
00000000000000000000010025000.00
00000000000000000000010025000.00
* 4 record(s) selected.
Rather It should be
10025000.00
10025000.00
10025000.00
10025000.00
For the above 4 rows and it should be 'char' in data type.

Just LTRIM or STRIP the leading 0s

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab- Hide quoted text -

- Show quoted text -
Hi Serge ,

Thanks It worked . I did modified it a bit .

Thanks :)
Regards
Bikash Karan
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
7075
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done...
13
5565
by: muss | last post by:
how to convert decimal number in a hexadecimal number using C? Please help me. Thanks.
32
46125
by: saima | last post by:
a program that takes a decimal number input from the user and displays its binary number equivalent in 12 bits on the screen. For example: Enter a decimal number: 32 Its Binary Equivalent is : ...
14
16199
by: dharmdeep | last post by:
Hi friends, I need a sample code in C which will convert a Hexadecimal number into decimal number. I had written a code for that but it was too long, I need a small code, so request u all to...
1
2680
by: ahoway | last post by:
I am working on a program where I have to enter a decimal number and enter a base and it converts according to base. output: Please enter a decimal number to convert: 15 <-input What base would...
19
3566
by: VK | last post by:
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/ b495b4898808fde0> is more than one month old - this may pose problem for posting over some news servers. This is why I'm...
0
2199
by: Metalpalo | last post by:
Hello everybody I created small batch file in MSDOS. In this batch file i need to print hexadecimal value of some env. variable. For example: I enter value via command :set /P PAR=Enter...
2
2000
by: marulasiddesh | last post by:
can any one help me out in converting a decimal number to binary number?
2
1939
by: Hets | last post by:
Write a C program which can convert decimal number into binary number.
23
9746
by: neha_chhatre | last post by:
which is the best format specifier(data type) if i have to work with decimal number. also please tell me the syntax for truncating a decimal number please reply as soon as possible
0
7221
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7109
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7029
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5039
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.