It may not be in your knowledge, but one thing I can bet for is that there must be something like that to achieve my requirement. Beacuse it is not a very rare kind of requirement. It is generally needed for day-to-day programming.
May be I will have to search somewhere else.
Yes, there is always more than one way to skin a cat ;)
In your algorithm, will it be the most previous row that you want? In oracle there isnt a way to start looping through a cursor record set and then suddently reverse direction and loop back again.
But there are alternatives or other ways. How do you define the order of the record set you want to loop through? See if you suddenly wanted to reverse direction it would indicate that you reached some specific point that indicated such a need. I dont see an order by in your cursor. the reason i want to know is that we can use analytic functions like lag() or row_Number() or rank() to order the rows a specific way.
For example lag() can be used to return the previous rows value of a certain field based upon some order defined. likewise lead() will return the next rows value of a certain field based upon a sort order given.
can you give a little more info on what it is you need to do?