Ordering with row limiting in Oracle.

I encountered this issue after I started working with Oracle after working with SQL server for about 15 years. After all that time I’d forgotten a few things about how Oracle behaves. One of the things that I had forgotten was that Oracle applies the limiting before ordering the data from the select, so if you are expecting to have the order applied first you will have to do the following:

Basically you have to order the entire table and then apply the limiting condition.

Let me know if this helps you out or you’ve encountered a similar issue.

Mike GriffithOrdering with row limiting in Oracle.