-
Hi
Is there any readily available DateDiff function in Oracle, which is available in SQL server? My main intension is when I pass the parameters as
DateDiff(ss, current_timestamp,lastacc_datetime), it should return the value in no of seconds, same as for mi and hh.
If any one already has this kind of function, Can you please share with this forum? Or can you suggest me the logic in PL/SQL.
Regards
-
Hi,
there is no special function for that.
If you simply subtract two dates you get the difference in days. You can get hours, mins and secs with multiplicaton by 24, 24*60, 24*60*60.
Ales
-
For example:
Code:
SQL> select sysdate - to_date('04/06/2002','mm/dd/yyyy') from dual;
SYSDATE-TO_DATE('04/06/2002','MM/DD/YYYY')
------------------------------------------
4.47871528
SQL> select (sysdate - to_date('04/06/2002','mm/dd/yyyy')) * 24*60 secs from dual;
SECS
----------
6450.75
-
This is why I love this forum. Thanks to all for your contribution.
Regards