Subject How to cast a float?
Author phil_hhn
I have a float in a table which represents a percentage, eg 30.75

When I run a particular query I want to return this value with a %
symbol after it, i.e as 30.75%.
If my query is:

select cast(depreciation_rate as integer) || '%' from my_table

This works fine, except of course only the integer part of the value
is retained. So I changed the query to:

select cast(depreciation_rate as char) || '%' from my_table

But this causes an "Arithmetic overflow or division by zero... or
string truncation".

So what is the correct way to do this? (Alternatively, what is the
correct way to return this float as a percentage value?)