zoukankan      html  css  js  c++  java
  • 如何用oracle从身份证信息中提取出生日期?

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

    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'
  • 相关阅读:
    Linux下C程序插入执行shell脚本
    #ifdef预编译相关用法
    LAMP开发之环境搭建(2014.12.7在ubuntu下)
    Qt在VS2010的安装与配置
    vs2010配备boost编程环境
    Ubuntu虚拟机与Window、Arm的通信
    大小端测试程序
    Ubuntu安装google Gtest
    设计模式之单例模式
    设计模式之原型模式
  • 原文地址:https://www.cnblogs.com/yangxiaowei/p/4424709.html
Copyright © 2011-2022 走看看