difference between two timestamps [message #236228] |
Wed, 09 May 2007 06:33  |
soujanya_srk
Messages: 111 Registered: November 2006 Location: HYDERABAD
|
Senior Member |
|
|
i know how to calculate time difference in seconds given
two dates, (using to_date() - to_date())
i am testing the performance of a function, and am capturing
the systimestamp in one variable(bs)
bs:=systimestamp immediately after begin
and before end, i say ls:=systimestamp
now i want a query to find out the difference between these
two variables...basically, its the difference in milliseconds
between two dates...
so that i can fetch it into another variable, and then see
how fast my function is performing
can anyone please tell me how to find out difference between
2 systimestamps?
that is difference in milliseconds
|
|
|
|
|
|
Re: difference between two timestamps [message #236263 is a reply to message #236228] |
Wed, 09 May 2007 07:59   |
soujanya_srk
Messages: 111 Registered: November 2006 Location: HYDERABAD
|
Senior Member |
|
|
thanks a lot for both of u, now i am getting a lot of
zeroes in the result...so does it mean the input itself is in
milliseconds? in that case is there a way to print the result
in decimals...i mean assuming the time difference is in
milliseconds ...........
|
|
|
|
Re: difference between two timestamps [message #236277 is a reply to message #236251] |
Wed, 09 May 2007 08:22   |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
Quote: |
Unfortunatly EXTRACT can't extract subsecond part.
|
That's what I believed, too, until I researched the question just now. I have found that extract actually returns the seconds with fractions.
E.g. when I run my script the 5.300331 second difference between the timestamps is returned as 5.300331 seconds with extract.
TS1 : 15:17:43 836901 / TS2: 15:17:49 137232
Difference as Interval : +00 00:00:05.300331
Difference as MS : 5300.331
That's on Version 9.2.0.8.
|
|
|
|
|
|