1-- Duration between 2 timestamps
2SELECT (extract(DAY FROM TIME2 - TIME1) * 24 * 60 * 60)
3 + (extract(HOUR FROM TIME2 - TIME1) * 60 * 60)
4 + (extract(MINUTE FROM TIME2 - TIME1) * 60)
5 + extract(SECOND FROM TIME2 - TIME1)
6FROM DUAL;