I'm not sure what is your complete code, but from what you mentioned in your last post, the logic is incorrect. It should be something like this
CASE WHEN udf_isnumeric(c_pol) = 1 THEN substr(c_pol, 1, 8) ELSE substring('0000' + cast(c_pol as integer) from character_length('0000' + cast(c_pol as integer)) - 8 for character_length('0000' + cast(c_pol as integer)))