0

I am new in PL/SQL and I am trying the ROWNUM keyword.

If I query this:

SELECT *
FROM my_table
WHERE ROWNUM <= 1

I am getting a result. Even in this case:

SELECT *
FROM my_table
WHERE ROWNUM = 1

But if I try

SELECT *
FROM my_table
WHERE ROWNUM = 2

I get an empty result..

But the table my_tablehas more than one tuple.

Can you help me?

Thank you!

Lalit Kumar B
  • 47,486
  • 13
  • 97
  • 124
mrbela
  • 4,477
  • 9
  • 44
  • 79

1 Answers1

1

ROWNUM is a psuedo column that has a value AFTER the result set is returned. Thus you can use where rownum < 2 but you can't select where ROWNUM equals a value because it does not have a value to compare to yet.

Gary_W
  • 9,933
  • 1
  • 22
  • 40