To create a test table:
CREATE OR REPLACE VIEW V asselect ' a ' as C from Dualunion Allselect ' B ' as C from Dualunion Allselect ' C ' as C from Dualun ION Allselect ' d ' as C from Dualunion Allselect ' E ' as C from dual; SELECT * from V;
If you want to query the first two data, you can use pseudo-column rownum to complete:
SELECT C from v WHERE ROWNUM < 3;
The query results are as follows:
What happens if you query directly with rownum = secondly?
SELECT C from v WHERE ROWNUM = 2;
The query results are as follows:
This is because rownum is a pseudo-column added to the result set, that is, the result set is followed by a column (emphasis: first, the result set). It always starts at 1. So your chosen result cannot be no more than 1, and there are other values greater than 1.
The correct query statement should look like this, Sir, into the serial number:
Select C from (select ROWNUM as No, C from v) WHERE no = 2;
The query results are as follows:
Limit the number of rows returned