In other words, is the following \"cursoring\" approach guaranteed to work:
I think this can go wrong depending on the duration of transactions Consider the following sequence of events:
The row inserted by Transaction A will never be found by your code. It was not already committed when step 6 was performed. And when the next query is performed it will not be found, because it has a lower value in the identity column than the query is looking for.
It could work if you perform the query with a read-uncommitted isolation mode