在 Oracle SQL 中计算今天与受雇人员之间的天数?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3129707/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Count the number of days between today & the hiredate in Oracle SQL?
提问by LJme
How can I count the number of days between (sysdate) & a column called hiredate
in PL/SQL.
如何计算 (sysdate) 与hiredate
PL/SQL 中调用的列之间的天数。
Thanks.
谢谢。
回答by akf
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.
这将导致以十进制表示的天数。该TRUNC
时间戳将确保你会得到连续调用一个一致的结果。
回答by waqar
select round((months_between(sysdate,hiredate) * 30),0) from table