How can I subtract one timestamp from another in Oracle?
for example I have:
timestamp_1 = 2021-06-25 08:18:17,207141
timestamp_2 = 2021-06-24 17:41:06,787111
how I can take a different between?
I need a diff in seconds
CodePudding user response:
You can simply subtract the two values from each other
SELECT TO_TIMESTAMP ('2021-06-25 08:18:17,207141', 'YYYY-MM-DD HH24:MI:SS,FF')
- TO_TIMESTAMP ('2021-06-24 17:41:06,787111', 'YYYY-MM-DD HH24:MI:SS,FF')
FROM DUAL;
00 14:37:10.420030