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 last published in May 2003

Dig Deeper on Oracle and SQL

PRO+

Content

Find more PRO+ content and other member only offers, here.

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.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close