3
USER_DTLS table
-----------------
ID  NAME    ADDRESS ROLL

1   SARAH   (Clob)  14
2   ALICE   (Clob)  13
3   ANU (Clob)  12

on this table

SELECT * FROM test.USER_DTLS
 WHERE ROWNUM =1; 

return result

1   SARAH   (Clob)  14

but while trying

SELECT * FROM test.USER_DTLS
 WHERE ROWNUM =2;

It return no result can anybody please help this

user272735
  • 10,473
  • 9
  • 65
  • 96
Vinoth Kumar
  • 111
  • 1
  • 4
  • 8

1 Answers1

7

Oracle's ROWNUM starts on 1 and is only incremented when assigned to a row that passes the WHERE condition.

Since you're filtering on ROWNUM=2, ROWNUM=1 doesn't pass the WHERE condition, and ROWNUM is therefore never assigned to a row and incremented to 2.

This ask Tom article goes into detail on this, and is very good reading if you want to use ROWNUM efficiently.

Joachim Isaksson
  • 176,943
  • 25
  • 281
  • 294