select
name,
md5(indvl_id_nbr) as indvl_id_nbr,
case when char_length(indvl_id_nbr)=18 or char_length(indvl_id_nbr)=15 then substring(indvl_id_nbr from 1 for 6)
end as id_prefix,
case when char_length(indvl_id_nbr)=18 then substring(indvl_id_nbr from 7 for 8)
when char_length(indvl_id_nbr)=15 then '19' || substring(indvl_id_nbr from 7 for 6)
else null end as id_brth_dt
from myschema.table_test;
---------------------
作者:波特王子
来源:CSDN
原文:https://blog.csdn.net/sptoor/article/details/18309161
版权声明:本文为博主原创文章,转载请附上博文链接!
转载于:https://www.cnblogs.com/telwanggs/p/10766207.html