Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize paging query by Oracle

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is about how Oracle implements paging queries. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

What is a paged query

Paging query is to display the result set of query by page. For example, a result set has 1W rows and 100 database rows per page. And you get the result set on page 2.

Why do you want to query in pages

If a result set has dozens of W rows, it must not be displayed on one page. At the same time, displaying database records needs to be loaded into memory, while displaying large amounts of data consumes more memory.

We can use paging queries for the following purposes:

In order to accurately locate the contents of the result set

In order to save memory

In order to display moderate data in limited page space.

How to realize paging query

EMP table using Oracle

Select * from (select rownum rn, e. * from (select * from EMP) e)

The results are as follows:

The source code for paging query is as follows:

Select * from (select rownum rn, e. * from (select * from EMP) e) where rn > pageSize * (page-1) and rn 5 and rn 5 and rn

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report