select
(case
when length(regexp_extract(sum(current_money),'([0-9]+\\.)([0-9]+)(E-*[0-9]+)',2))=0
then sum(current_money)
when length(regexp_extract(sum(current_money),'([0-9]+\\.)([0-9]+)(E[0-9]+)',2))<=cast(regexp_extract(sum(current_money),'(E)([0-9]+)',2) as int)
then rpad(regexp_replace(regexp_extract(sum(current_money),'([^E]+)',1),'\\.',''),cast(regexp_extract(sum(current_money),'(E)([0-9]+)',2) as int)+1,'0')
when length(regexp_extract(sum(current_money),'([0-9]+\\.)([0-9]+)(E[0-9]+)',2))>cast(regexp_extract(sum(current_money),'(E)([0-9]+)',2) as int)
then concat(substr(regexp_replace(regexp_extract(sum(current_money),'([^E]+)',1),'\\.',''),1,cast(regexp_extract(sum(current_money),'(E)([0-9]+)',2) as int)+1),'\.',
substr(regexp_replace(regexp_extract(sum(current_money),'([^E]+)',1),'\\.',''),cast(regexp_extract(sum(current_money),'(E)([0-9]+)',2) as int)+2))
when sum(current_money) regexp 'E-'
then concat('0.',repeat('0',cast(regexp_extract(sum(current_money),'(E)(-)([0-9]+)',3) as int)-1),regexp_replace(regexp_extract(sum(current_money),'(.+)(E)',1),'\\.',''))
else sum(current_money)
end)
from cert_flow_range where dt =20170629 and product_id=38408200 and detail_type=1;
其中sum(current_money)为科学记数法表示,通过一堆case when 转换为long