Q

FETCH FIRST n ROWS ONLY functionality in Oracle

How can I limit the resulting rows of an ordered SELECT statement without using a nested select with order clause in the inner select? In DB2 SQL, I currently use the FETCH FIRST n ROWS ONLY.

Oracle does not have the same functionality that you describe in DB2. Oracle's solution to the problem is to use the nested SELECT with an ORDER BY clause to limit rows. Oracle 9i may be able to help your problem by introducing new analytical functions like RANK and DENSE_RANK. But you'd need to have some paritioning column to make those functions work for you.

For More Information

This was first published in May 2003

Dig deeper on Oracle and SQL

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close