top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

how to write a query to select Nth row from a table in Oracle SQL?

0 votes
925 views
how to write a query to select Nth row from a table in Oracle SQL?
posted Sep 22, 2014 by Archana

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote
 
Best answer
select rownum, empno, ename from emp where rowid in (select rowid from emp where rownum <=&upto minus select rowid from emp where rownum< &Start);

Inout:
Enter value for upto: 10
Enter value for Start: 7

output:
ROWNUM EMPNO ENAME


1 7782 CLARK
2 7788 SCOTT
3 7839 KING
4 7844 TURNER

answer Sep 23, 2014 by Arun Gowda
0 votes
SELECT * FROM
(SELECT ROW_NUMBER() OVER (ORDER BY SALARY DESC) AS SAL, * FROM TABLE2) sub
WHERE SAL = n

n-Give the nth row number or if you want which row then give it that row number
answer Nov 14, 2014 by Manikandan J
...