博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何用oracle从身份证信息中提取出生日期?
阅读量:6906 次
发布时间:2019-06-27

本文共 1090 字,大约阅读时间需要 3 分钟。

在项目开发中,有从身份证信息中提取出生日期的需求:

1.对18位身份证,因为有多个表,所以用到它们的关联,示例如下:

update pfapperosoninformation  p set p.pbirthday  = to_date(substr(p.perqualinumber,7,8),'YYYY-MM-DD')
where p.pfpeopleid = (
       select max(s.personnel_id) from app_institutions_personnel s,
       pfapprovalinformation      a,
       sys_manage_unit   u
        where    
        s.personnel_id =p.pfpeopleid and s.org_id = a.pfappid and u.mid=a.mid and u.mcode not in('41417705X','414177068','41419989X','414477167')
  )
and lengthb(p.perqualinumber)=18 and p.pbirthday is null  
 
2.对15位身份证而言,它的一个例子如下:
update pfapperosoninformation  p set p.pbirthday  = to_date(to_char('19'||substr(p.perqualinumber,7,6)),'YYYYMMDD')
where p.pfpeopleid = (
       select max(s.personnel_id) from app_institutions_personnel s,
       pfapprovalinformation      a,
       sys_manage_unit   u
        where    
        s.personnel_id =p.pfpeopleid and s.org_id = a.pfappid and u.mid=a.mid and u.mcode not in('41417705X','414177068','41419989X','414477167')
  )
and lengthb(p.perqualinumber)=15 and p.pbirthday is null  and substr(p.perqualinumber,9,2)>='01' and substr(p.perqualinumber,9,2)<='12'

转载于:https://www.cnblogs.com/yangxiaowei/p/4424709.html

你可能感兴趣的文章
keepalived主备节点都配置vip,vip切换异常案例分析
查看>>
我的2014--新的开始,新的征程,加油!
查看>>
排序算法(一)
查看>>
使用jconsole监控tomcat性能情况
查看>>
ligerui grid行编辑示例
查看>>
linux安装或移植zencart系统
查看>>
动态权限
查看>>
MySQL 主从复制
查看>>
LayoutBuilder 构建一个窗口大小的widget树。 并可以获取widget 的狂宽高
查看>>
Python OpenCV学习笔记之:图像金字塔
查看>>
3月上旬中国数据域名总量跌至22.8万个 增长略有波动
查看>>
3月末全球域名商域名解析量23强:爱名网跌至第十七
查看>>
yii2 资源目录问题
查看>>
基于TensorFlow.js的JavaScript机器学习
查看>>
Cisco三层vlan与路由配置
查看>>
htpasswd设置HTTP Basic认证 保护管理后台页面
查看>>
Android自定义控件之轮播图控件
查看>>
Lucene介绍和创建索引和搜索初步
查看>>
LNMP的基础上搭建wordpress
查看>>
祝福你的旅行
查看>>