开发者

Count the number of days between today & the hiredate in Oracle SQL?

开发者 https://www.devze.com 2023-01-04 18:25 出处:网络
How can I cou开发者_开发知识库nt the number of days between (sysdate) & a column called hiredate in PL/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
0

精彩评论

暂无评论...
验证码 换一张
取 消