Limit The Number of Rows Returned by An Oracle Query

Posted by Agung Pambudi in ,
How do I limit the number of rows returned by an Oracle query?


Oracle. (source: www.dbtalks.com)


In Oracle, the only thing people mention is the rownum pseudo-column

select * from sometable where rownum <= 10

SELECT column_name(s) FROM table_name WHERE ROWNUM <= number;

Example in Java

stmt.executeQuery("SELECT airlines,dep_time,arr_time,economi_rate FROM cms_flightdetails where ROWNUM <= 5");


No comments:

Post a Comment