Say for example the employee table has 100 records. We need to get the records in the range 40 to 50. We know how to use rownum and rowid in a select query. A simple query using rownum, rowid and minus helps us to get the data we required.
Solution:
select rownum, empno, ename from emp where rowid in
(select rowid from emp where rownum <=&upperlimit
minus
select rowid from emp where rownum<&lowerlimit);
Enter value for upperlimit: 60
Enter value for lowerlimit: 40
This query will give you rows between 40 & 60
****Happy CoDiNg!!****
No comments:
Post a Comment