oracle mybatis分页查询
时间: 2023-08-27 13:17:07 浏览: 172
根据你提供的引用内容,我可以给出以下回答:
在Oracle中使用MyBatis进行分页查询,有多种方法可以实现。你可以在userInfo.xml中编写查询语句,然后使用ROWNUM来实现分页。一个示例查询语句如下:
```xml
<select id="queryUserListForPage" parameterClass="Page" resultMap="UserInfoResult">
select *
from (
select t.*, ROWNUM as RM
from (
select *
from tb_user_info
) t
where ROWNUM <= #max#
)
where RM > #offset#
</select>
```
另一种方法是在查询语句中使用子查询和ROWNUM,并使用别名来实现分页。一个示例查询语句如下:
```sql
select *
from (
select row_.*, rownum rownum_
from (
select *
from userinfo
) row_
where rownum <= #{pageNum} * #{pageSize}
)
where rownum_ > (#{pageNum} - 1) * #{pageSize}
```
需要注意的是,以上示例是在Mapper.xml中编写的查询语句,其中的参数和结果映射也需要进行相应的配置。
参考资料:
引用内容来源:https://blog.csdn.net/qq_35246620/article/details/110802705
引用内容来源:https://www.cnblogs.com/sunlong88/p/10322599.html
引用内容来源:https://zhuanlan.zhihu.com/p/50126497<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [mybatis+oracle实现分页查询--非常简单实用](https://blog.csdn.net/change2970955076/article/details/77427901)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Mybatis实现Oracle 分页](https://blog.csdn.net/qq_45315910/article/details/100156072)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文