I have a variable, price dec(5,0)
. How can I concat a static string "dollar" to that and save as a char(10)
?
If the price is 55555, the result should be 55555 Dollar and this should be saved as a char(11)
.
How can I do it? I tried casting and just concat using '+', but it was not working.
The concat operator in DB2 is a double pipe, ||
.
Also, you'll need to cast
the decimal value to a char before you can concatenate.
Something like:
select cast(55555 as char(5)) || ' Dollar' from sysibm.sysdummy1