This article is a mirror article of machine translation, please click here to jump to the original article.

View: 12787|Reply: 0

[Source] Oracle uses parsing functions row_number efficient pagination

[Copy link]
Posted on 8/16/2016 10:03:36 AM | | | |



Oracle pagination
(1) Use rownum keywords (three-layer nesting)
SELECT * FROM ( SELECT A.*,ROWNUM  num FROM   ( SELECT * FROM t_order ) A  WHERE  ROWNUM<=15 )  WHERE num>=5; --returns data on lines 5-15
(2) Use row_number parsing function for pagination (more efficient)
SELECT xx.* FROM( SELECT t.*,row_number() over(ORDER BY o_id)AS num FROM t_order t )xx WHERE num BETWEEN 5 AND 15; --returns data on lines 5-15
Parsing functions can be formatted
function() over(pertion by field order by field);
Pertion is partitioned by a field
Order sorted by the field






Previous:{&quot;ORA-12514: TNS: Listener does not currently recognize the service requested in the connection descriptor&quot;}
Next:C# uses Oracle database to execute multiple query statements, not stored procedure methods
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com