Thursday, August 24, 2017

year month days

select join_dt, sysdate         ,trunc(months_between(sysdate, join_dt) / 12) as yrs
         ,trunc(mod(months_between(sysdate, join_dt), 12)) as mnths
        ,trunc(sysdate - add_months(join_dt, trunc(months_between(sysdate, join_dt)))) as dys from emp_mast where emp_id='010001'

 JOIN_DT   SYSDATE          YRS      MNTHS        DYS
--------- --------- ---------- ---------- ----------
01-NOV-10 24-AUG-17          6          9         23

No comments:

Post a Comment

How to install and configure Oracle Apex 24.1 with ORDS 22, Tomcat 9 and Jasper Report 7 on Oracle Linux 8.10

#########################Install Oracle  APEX 24.1################################ ----------------------------------------------------...