Count the number of days between today & the hiredate in Oracle SQL?
How can I cou开发者_开发知识库nt the number of days between (sysdate) & a column called hiredate
in PL/SQL.
Thanks.
You could try the following:
SELECT TRUNC(sysdate) - TRUNC(t.hiredate) FROM myTable t;
This will result in a count of days represented in decimal. The TRUNC
of the timestamps will ensure that you will get a consistent result on successive calls.
select round((months_between(sysdate,hiredate) * 30),0) from table
精彩评论