Working with Oracle TIMESTAMP data type is so much easier than Oracle’s DATE data type (which of course) included date & time.
TIMESTAMP is more granular (detailed). Oracle’s TIMESTAMP includes micro seconds (6 digits to the right of the decimal point) , exactly like DB2’s TIMESTAMP.
For TIMESTAMPs in Oracle simply substract one from the other.
SELECT ts1 , ts2 , ts2 – ts1
FROM …
The result of such an operation is NOT a TIMESTAMP. It is a DURATION in the format of
number of days followed by number of hours and minutes and seconds and microseconds.
A subtle distinction – but let me use an example of subtracting June 28 from June 30. The answer is 2 days. The answer is NOT January 2.
Discuss This Question: 1  Reply