About this site
Links to us
General :: Databases :: Oracle
Basic information to help you getting up to speed with Oracle, and solutions for advanced problems.
This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Generated 20:00:27 on Jun 4, 2020
How can I limit the number of rows in Oracle
I have got a query that returns thousands of rows but I'm only interested in the first 20 records. In mysql I can limit the returned data (and thus the network traffic) with the LIMIT start,number clause, where start is the starting row and number is the number of rows that I want to see.
Is something similar possible in Oracle as well?
Oracle has a system attribute ROWNUM for each record returned. A query that only returns the first 20 records would look like the one in the example.
ROWNUM starts counting with 1.
select col from tbl limit 20;
select col from tbl where rownum<=20;
select top 20 col from tbl;
|Most recent comments