BoulderBum
Programmer
I have sort of a random query that I can pretend exists in a vacuum. By "vacuum" I mean I won't really know the sort criteria or the keys to tell how to explicitly select the next/previous record. I will, however, have a distinct key for a record I want to select the previous/next record for, so I'm wondering how I can best fetch the previous/next record for a random query.
e.g. If I have a table with the rows:
record 12
record 99
record 19
record 17
and I know I have a record cooresponding to 19, what would be the best way to fetch the next record (cooresponding to 17).
I was thinking of maybe declaring a cursor, then doing a fetch previous/next, but I'm not sure how to quickly navigate to e.g. record 19 in the example above, and I'm wondering if there's a better way to do it anyway.
e.g. If I have a table with the rows:
record 12
record 99
record 19
record 17
and I know I have a record cooresponding to 19, what would be the best way to fetch the next record (cooresponding to 17).
I was thinking of maybe declaring a cursor, then doing a fetch previous/next, but I'm not sure how to quickly navigate to e.g. record 19 in the example above, and I'm wondering if there's a better way to do it anyway.