Oracle如何实现按身份证号得到省市、性别、年龄
发布时间:2020-07-17 14:51:12
来源:亿速云
阅读:72
作者:小猪
栏目:数据库
小编这次要给大家分享的是Oracle如何实现按身份证号得到省市、性别、年龄,文章内容丰富,感兴趣的小伙伴可以来了解一下,希望大家阅读完这篇文章之后能够有所收获。
1、通过身份证号查询所在省市
SELECT
count(*) as total,
case substr(t.CERTNO,0,2)
when '11' then '北京市'
when '12' then '天津市'
when '13' then '河北省'
when '14' then '山西省'
when '15' then '内蒙古自治区'
when '21' then '辽宁省'
when '22' then '吉林省'
when '23' then '黑龙江省'
when '31' then '上海市'
when '32' then '江苏省'
when '33' then '浙江省'
when '34' then '安徽省'
when '35' then '福