I believe everyone has some knowledge about the ORACLE ROWNUM statement. The following describes how to use the ORACLE ROWNUM statement in detail, hoping to help you.
The pseudo column ROWNUM contains the current row number. Many people will find that the following method does not work when they first try to return a sub-set of records in the middle of the table:
Select * from all_objects where rownum between 30 and 49;
This method does not work because the ROWNUM column is applied to the record only when the record is retrieved or filtered. The first row is thrown when it is retrieved because its ROWNUM is 1. Then, the next row is taken out; it will also be thrown because it is the new "1", and so on until all rows are used. This query does not return any records. The solution is to retrieve 1 to 30 rows of records when you see records between 30 and 50:
Select * from all_objects where rownum <= 49;
Then, you can use it as a subquery and filter out all records before the start point (note that I must provide an alias for "rownum" to compile ):
Select * from (select rownumr, all_objects. * from all_objects where rownum <=
49) t
Where t. r> = 30;
To ensure its efficiency, you may wish to use the bound variable for this restriction. This will use all these types of requests to be exactly the same literally, eliminating the re-resolution of the query when each request has different ranges:
Select * from (select rownumr, all_objects. * from all_objects where rownum <=: min) t
Where t. r >=: max;
Note that the oracle rownum statement is calculated after sorting, so the order by clause is used to obtain a new record ORDER. However, the rule-based optimizer uses ROWNUM for "short-circuit" queries and returns records to the next part of queries when the ROWNUM clause is satisfied.
Oracle paging query statements can be applied in the format given in this article.
Oracle paging query statements
Oracle index type
How to create an Oracle Index
Connect to the oracle database using JAVA
C # connect to the Oracle database to query data