Oracle使用正则表达式离不开这4个函数:

1。regexp_like

select t3.cert_no from table_name t3 where regexp_like(t3.cert_no, '^(\d{15}|\d{18})$')

2。regexp_substr

SELECT REGEXP_SUBSTR('first field, second field , third field', ', [^,]*,') FROM dual

3。regexp_instr

SELECT REGEXP_INSTR ('hello itmyhome', 'e') FROM dual; 

4。regexp_replace

select regexp_replace('','','abc') from dual;

拓展

1,通过证件号码获取生日

 select to_date(substr('',7,8),'yyyyMMdd') from dual;

2,通过证件号码获取年龄

select trunc((to_char(sysdate, 'yyyyMMdd') -
to_char(to_date(substr('', 7, 8),
'yyyy-MM-dd'),
'yyyyMMdd')) / 10000)
from dual;

3,通过证件号码获取年龄不满16周岁的生日(ps:证件号码为15位或者18位,今年为2019年16岁出生于20030101)

select to_date(substr(t.cert_no, 7, 8), 'yyyyMMdd')
from table_name t
where to_date((case when length(t.cert_no) = 18 then
substr(t.cert_no, 7, 8) when length(t.cert_no) = 15 then
'' || substr(t.cert_no, 7, 6) end),
'yyyyMMdd') < to_date('', 'yyyyMMdd')

最新文章

  1. C# upnp
  2. ASP.NET MVC中分析淘宝网页发生乱码标题搞定方法
  3. 今天再分享一个TextView内容风格化的类
  4. .NET基础拾遗(7)多线程开发基础4
  5. 修改host文件的P处理
  6. VS2008下OpenCV1.0的设置
  7. Lazy.js : 让 JavaScript 变懒
  8. php实现批量修改文件名称
  9. Java字符串格式化记录
  10. matplotlib图例-【老鱼学matplotlib】
  11. nvwgf2umx.dll 显卡崩溃问题尝试修复
  12. liunx学习笔记
  13. Xamarin Essentials教程安全存储SecureStorage
  14. tomcat8 tomcat-users相关配置
  15. 百度地图api公交路线,IE下跳转百度地图后中文变成乱码的解决办法
  16. ueditor编辑器视频上传不能预览的问题
  17. MFC函数—SetRegistryKey
  18. 面向对象的JavaScript --- 动态类型语言
  19. 网络与多线程---OC中多线程使用方法(一)
  20. PCL点云变换与移除NaN

热门文章

  1. How to mount remote Windows shares
  2. vmware修改虚拟机名称
  3. JS批量绑定事件
  4. QTP(8)
  5. Android基础相关面试问题-binder面试问题详解
  6. go学习开篇
  7. Python:面向对象编程3 定制类(有更新)
  8. mysqldump --tab=path参数使用
  9. kylin实战(一)
  10. PHP Swoole websocket协议实现