Perceived 'Wrong Results' Using ROWNUM with DISTINCT or ORDER BY
Last updated on FEBRUARY 10, 2017
Applies to:Oracle Database - Personal Edition - Version 126.96.36.199 and later
Oracle Database - Enterprise Edition - Version 188.8.131.52 and later
Oracle Database - Standard Edition - Version 184.108.40.206 and later
Information in this document applies to any platform.
A select statement using 'DISTINCT' or 'GROUP BY' and a 'ROWNUM' predicate is returning fewer rows than expected.
For example, the following query might return only 10 rows even when there are at least 100 distinct values in the table:
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
Million Knowledge Articles and hundreds of Community platforms