How to calculating the difference between dates on different rows [message #18729] |
Tue, 12 February 2002 13:54 |
UmaSund
Messages: 22 Registered: February 2002
|
Junior Member |
|
|
Hi
I have a set of rows returned by a query regarding a Job. One of the Columns is last_update date.The result is ordered by this date asc only.
Now, I need to Calculate the difference between row 2 date and row 1 date and display it for row 1, then difference bewteen row 3 and row 2 date and display it for row 2 and so on.
The numbers of rows which will be returned for a Job will vary. Some may return 3 others may return say 20.
Is this calculation possible using sql or pl/sql?
How can it be achieved.
Thanks in adavance.
Thanks
-UmaSund
|
|
|
Re: How to calculating the difference between dates on different rows [message #18733 is a reply to message #18729] |
Tue, 12 February 2002 18:39 |
Somu
Messages: 24 Registered: February 2000
|
Junior Member |
|
|
Hi,
You can do this in a PL/SQL.
The steps you can follow.
1. Declare the Cursor as it in the normal with your order condition.
2. Fetch the 1st record and store it into a memory
3. Fetch the 2nd record and store it into a memory
4. Find out the date difference between these two
records and display it in the report
if you need the sample, let me know..
|
|
|
|