You will always get an error if you you are casting a character data into numeric INTEGER/DECIMAL. You should check whether the content is numeric is or not before casting it.
I guess your UDF udf_isnumeric() is the one that can handle this scenario
when i_pdt_gl in('12984','22984') then
CASE WHEN udf_isnumeric(clm.C_POL) = 1 THEN trim(cast(cast(clm.C_POL as decimal (10,0) format '9999999999') as char(10)))
ELSE 'BAD DATA'
END I am guessing that the UDF udf_isnumeric that youa re using in your CASE statement is for the same purpose...
↧
Case statement returning "Bad character in format or data...." - response (5) by Qaisar Aftab Kiani
↧