ERROR:could not parse “xx” as type decimal
无法解析"xx",作为十进制类型
出现原因
可能是由于进行数据判断的时候出现脏数据,脏数据无法转化为数值类型的值进行比较
例如:
update table a set enterprise_scale=(case
when split_part(a.maibusinc,'万',1)>=40000 then '高'
else 'NULL'
end)
当我们的maibusinc值中含有脏数据无法转化为数据进行大小的比较时就出现了此问题
例如: ‘空格128.65万’ 此时便会报 无法解析" 128.65万",作为十进制类型
解决方案
使用trim去除脏数据
update table a set enterprise_scale=(case
when trim(split_part(a.maibusinc,'万',1)::int)>=40000 then '高'
else 'NULL'
end)