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
  • 45,678
  • 12
  • 90
  • 118
mrbela
  • 4,156
  • 7
  • 42
  • 74

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,149
  • 1
  • 18
  • 35