Oracle SQL Limit  

Posted by Kishore in ,

Oracle SQL does not support anything like LIMIT in MySQL. You can just limit the
number of rows returned with rownum. So if you only want the first ten
records use:

SELECT * FROM table WHERE ROWNUM<10;>90 AND ROWNUM<100;

This is because Oracle checks for the first row and the condition is false,
as the rownum would be 1. So this row is not returned, thus the rownum is
still 0. So the rownum will never get to 90.

You can try :

SELECT * FROM table WHERE ROWNUM<101;
minus
SELECT * FROM table WHERE ROWNUM<91;

Alternate method:
select * from (select a, b, c, rownum as limit from mytable where conditions order by whatiwant) where limit>x and limit <y;

From http://www.weberdev.com/get_example-1445.html

This entry was posted on May 30, 2008 at Friday, May 30, 2008 and is filed under , . You can follow any responses to this entry through the comments feed .

0 comments

Post a Comment