View previous topic :: View next topic |
Author |
Message |
nag77 Beginner
Joined: 03 Jan 2006 Posts: 11 Topics: 8
|
Posted: Sat Jan 28, 2006 5:12 am Post subject: Pad Zeroes for a Numeric item in a Db2 table |
|
|
Hi
I have one variable named as numeric-item with SIZE 10.
Some NIs are with size 5.
NI
-----
1243231231
1243231231
12432
12432
If the 6th-10th bytes are not available ,I have to insert zeros in the spaces, i mean the vales of NI should be like
NI
-----
1243231231
1243231231
1243200000
1243200000
How can i do this??
Thanks in Advance..
Regards
Nag. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Sat Jan 28, 2006 5:55 am Post subject: |
|
|
nag77,
Try this
Code: |
SELECT REPLACE(your_Num_COL,' ','0')
FROM TABLE
;
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
nag77 Beginner
Joined: 03 Jan 2006 Posts: 11 Topics: 8
|
Posted: Sat Jan 28, 2006 6:05 am Post subject: |
|
|
Hi kolusu
I have other variables also in this table
ex: Fn pic x(10).
Ln Pic x(10).
NI pic x(10).
when this case i have to give the query as
SELECT REPLACE(25,30,' ','0')
FROM TABLE
;
is it right????
thanks
NAG |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Sat Jan 28, 2006 6:09 am Post subject: |
|
|
nag77,
where did you get the 25,30 from in your SELECT clause?
Your sql will be
Code: |
SELECT REPLACE(FN,' ','0')
,REPLACE(LN,' ','0')
,REPLACE(NI,' ','0')
FROM TABLE
;
|
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|