question

sagar 2 avatar image
sagar 2 asked

concatenation of decimal and varchar

Hello i am using IBM db2. I have 2 columns in my table : PER_DAY (DECIMAL(10,2)) DESCP (VARCHAR) I want to concat the two columns in my query... For Ex: PER_DAY=0.5 DESCP='ABCDEFGHIJ' I want them to be displayed as 0.5-ABCDEFGHIJ I'm using IBM DB2.
db2
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
sagar 2 avatar image
sagar 2 answered
I found it...I used concat(concat(rtrim(char(int(PER_DAY))), '.'), rtrim(right(char(PER_DAY - int(PER_DAY)), 3)))
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Well done on finding your answer, and thank you for posting it for other people having the same problem. Could you please mark the answer as 'accepted' in order that we can all see from the main page that your problem is resolved?
2 Likes 2 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.