oracle通过身份证号码获取年龄
select trunc((to_char(sysdate, 'yyyyMMdd') - to_char(to_date(substr('110101201701010016', 7, 8), 'yyyy-MM-dd'), 'yyyyMMdd')) / 10000) 年龄 from dual;
执行结果:
if you want to go fast,go alone,if you want to go far,go together
select trunc((to_char(sysdate, 'yyyyMMdd') - to_char(to_date(substr('110101201701010016', 7, 8), 'yyyy-MM-dd'), 'yyyyMMdd')) / 10000) 年龄 from dual;
执行结果: