昨天做完项目后让测试测试了一把,测试说分页查询貌似不起作用,翻到第4页以后,看到的数据结果都是相同的。
当时我就觉得很纳闷,不可能啊,分页组件应该是好的,咋可能有问题呢。带着疑问,我打开了自己的ide,在自己的机器上跑了一把,果然有问题。
有问题就要找问题:
首先把2条查询结果相同的sql打印出来到数据库中执行:
sql1:
复制代码 代码如下:
select *
from (select t.*, rownum rn
from (select t_e_id, t_e_name, t_e_tel, t_e_areacode
from (select t.eid t_e_id,
t.ename t_e_name,
t.etel t_e_tel,
t.areaid t_e_areacode,
t.biz_delete_time,
decode(areaid, '0730', '0', '1') orderseq
from vr_enterprise t
where t.eid not in (select eid from t_biz_erelation))
order by orderseq, biz_delete_time nulls last) t
where rownum < 25)
where rn >= 19
sql2:
select *
from (select t.*, rownum rn
from (select t_e_id, t_e_name, t_e_tel, t_e_areacode
from (select t.eid t_e_id,
t.ename t_e_name,
t.etel t_e_tel,
t.areaid t_e_areacode,
t.biz_delete_time,
decode(areaid, '0730', '0', '1') orderseq
from vr_enterprise t
where t.eid not in (select eid from t_biz_erelation))
order by orderseq, biz_delete_time nulls last) t
where rownum <18)
where rn >= 12
复制代码 代码如下:
select *
from (select t.*, rownum rn
from (select t_e_id, t_e_name, t_e_tel, t_e_areacode
from (select t.eid t_e_id,
t.ename t_e_name,
t.etel t_e_tel,
t.areaid t_e_areacode,
t.biz_delete_time,
decode(areaid, '0730', '0', '1') orderseq
from vr_enterprise t
where t.eid not in (select eid from t_biz_erelation))
order by orderseq, biz_delete_time nulls last) t)m
where m.rn >= 1 and m.rn <25
新闻热点
疑难解答