I’m trying to subtract two dates and expecting some floating values return. But what I got in return is as below:
+000000000 00:00:07.225000
Multiplying the value by 86400 (I want to get the difference in second) is getting something even more strange value being returned:
+000000007 05:24:00.000000000
any idea? I’m suspecting is has something to do with type casting.
I guess your columns are defined as
timestamprather thandate.The result of subtracting timestamps is an
intervalwhereas the result of subtractingdatecolumns is a number representing the number of days between the two dates.This is documented in the manual:
http://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements001.htm#i48042
So when you cast your timestamp columns to date, you should get what you expect:
Edit:
If you want to convert the interval so e.g. the number of seconds (as a number), you can do something like this:
The result of the above is
55499.5802