Many queries have the potential for returning large result sets. Most applications do not want to display the entire result set –they might want to display just the first 10 results. Or they might want to page through the results, showing results 0-9, then results 10-19, and so on.

The RANGE directive is used to specify this in the RQL query. The RANGE directive must come after the ORDER BY directive (if any). It has three forms. The first is the most common:

age > 30 RANGE +10

This causes only the first 10 results to be returned. If the result set is already less than 10, all results are returned.

The next form of the RANGE directive allows the results to start at a specified index:

age > 30 RANGE 10+

This causes the first 10 results to be skipped, and the remaining results to be returned.

The final form of the RANGE directive combines the above two forms, and is often used for paging:

age > 30 RANGE 40+10

This skips the first 40 results, then returns up to the next 10 results.

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices