I'm investigating an prod issue which has data as below in DB:
11
22
33
44
55
The cursor brings out the active set result in a random order sometimes as below :
44
55
11
22
33
Is this possible and valid?
The only way to make sure that query will return rows in desired order is to - guess what? - use the order by
clause.
So:
declare
cursor c1 is
select value
from your_table
order by value; --> this
Anything else is just pure luck (whether you will, or will not, get rows the way you thought you should).