- The row_limiting_clause allows you to limit the rows that are
returned by the query. - Queries that order data and then limit row output are widely used
and are often referred to as Top-N queries. - You can specify the number of rows or percentage of rows to return
with the FETCH_FIRST keywords. - You can use the OFFSET keyword to specify that thereturned rows
begin with a row after the first row of the full result set. - The WITH TIES keyword includes additional rows with the same
ordering keys as the last row of the row-limited result set (you
must specify ORDER BY in the query).
You can specify the row_limiting_clause in the SQL
SELECT statement by placing it after the ORDER BY clause.
Syntax:
subquery::=
{ query_block
| subquery { UNION [ALL] | INTERSECT | MINUS }
subquery
[ { UNION [ALL] | INTERSECT | MINUS } subquery ]...
| ( subquery )
{
[ order_by_clause ]
[OFFSET offset { ROW | ROWS }]
[FETCH { FIRST | NEXT } [{ row_count | percent PERCENT
}] { ROW | ROWS }
{ ONLY | WITH TIES }]
摘自oracle大学