标签:user rac ram 查询 str tab code class string
分页查询时用如下sql,查询的是第6到第10条数据
select t.* from (select u.username, rownum row_num from table_user u where rownum =< 10) t where t.row_num > 5
用页数来表示:
/** * * @param numOfPage 每页有几条数据 * @param page 第几页(从0开始) * @return */ public Map<String,Object> test(int numOfPage,int page){ Map<String,Object> param=new HashMap<String,Object>(); int startNum=1;//初始条数 int endNum=1;//初始条数 startNum=numOfPage*page; endNum=numOfPage*(page+1); param.put("startNum", startNum); param.put("endNum", endNum); return param; }
再写sql:
select t.* from (select u.username, rownum row_num from table_user u where rownum =< :endNum) t where t.row_num > :startNum
标签:user rac ram 查询 str tab code class string
原文地址:https://www.cnblogs.com/BonnieWss/p/9227638.html