Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle ordered resultset without order by clause

Is there a way to get "ordered" resultset from oracle table without actually using an "ORDER BY" clause?

I am working on an application that reads data from oracle table (which has no unique column) and I want to introduce some sort of resume mechanism so that in case of query failure (e.g. network error during fetch) we avoid reading rows that are fetched already.

The application is developed using oracle OCI and currently simple select queries are used.

Is there any efficient mechanism to achieve this?

like image 461
Ali Avatar asked Nov 25 '25 21:11

Ali


1 Answers

In some very special condition you have a defined order of results without given any ORDER BY clause. However, you shoul not rely on that, Oracle may change this behaviour any time.

Maybe you can count total number of rows (read SQL%ROWCOUNT after executioin of the query) and check this number with received records on your client.

like image 133
Wernfried Domscheit Avatar answered Nov 27 '25 12:11

Wernfried Domscheit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!