Here’s how to find the difference between two dates in SQL
The difference can be displayed in seconds minutes or hours depending on the upper('??') bit which you can fill with ss, mm, or hh
-- FIND DIF BETWEEN TWO DATES IN SECONDS ('SS') MINUTES ('MI') or HOURS ('HH')
select ( sysdate - (select MIN(DATE_UPDATED) from BILLING_TRANSACTIONS_REQ) ) -- FIND DIFFERENCE BETWEEN TWO DATES
* decode(upper('ss'),'SS',24*60*60,'MI',24*60,'HH',24,NULL) -- DECODE DATE DIFFERENCE
from dual
===
JD
No comments:
Post a Comment