How to match an integer value with a string in a DB2 procedure

I have a variable, price dec(5,0) . How can I bind the static dollar string to this and save as char(10) ?

If the price is 55555, the result should be 55555 US dollars, and this should be saved as char(11) .

How can i do this? I tried casting and just concat using "+", but it didn't work.

+4
source share
2 answers

The concat statement in DB2 is a double channel, || .

Also, you need to cast decimal value to char before you can concatenate.

Sort of:

 select cast(55555 as char(5)) || ' Dollar' from sysibm.sysdummy1 
+8
source

No casting required - both examples below work:

CONCAT (55555, "Dollar") as a "test column"

OR

55555 || Dollar AS Control Column 2

+2
source

All Articles