I have a variable, price dec(5,0) . How can I bind the static dollar string to this and save as char(10) ?
price dec(5,0)
char(10)
If the price is 55555, the result should be 55555 US dollars, and this should be saved as char(11) .
char(11)
How can i do this? I tried casting and just concat using "+", but it didn't work.
The concat statement in DB2 is a double channel, || .
||
Also, you need to cast decimal value to char before you can concatenate.
cast
Sort of:
select cast(55555 as char(5)) || ' Dollar' from sysibm.sysdummy1
No casting required - both examples below work:
CONCAT (55555, "Dollar") as a "test column"
OR
55555 || Dollar AS Control Column 2