日期:2014-05-16  浏览次数:20463 次

oracle 采用三层结构分页后有的页数据重复问题

表结构如下

create table AJ_JBXX_TEST
(
  AJBH   VARCHAR2(23) not null,
  FASJXX VARCHAR2(14),
  SLDW   CHAR(12),
  CZBS   VARCHAR2(1)
)

?分页语句如下

SELECT * FROM (SELECT A.*, ROWNUM RN FROM (
SELECT ajbh
  FROM aj_jbxx_test WHERE SLDW like '1507%' AND czbs < 3
 ORDER BY FASJXX DESC
 
) A WHERE ROWNUM <= 72)  WHERE RN > 64;

SELECT * FROM (SELECT A.*, ROWNUM RN FROM (
SELECT ajbh
  FROM aj_jbxx_test WHERE SLDW like '1507%' AND czbs < 3
 ORDER BY FASJXX DESC
 
) A WHERE ROWNUM <= 64) WHERE RN > 56;


SELECT * FROM (SELECT A.*, ROWNUM RN FROM (
SELECT ajbh
  FROM aj_jbxx_test WHERE(czbs < 3) AND (SLDW like '1507%')
 ORDER BY FASJXX DESC
 
) A WHERE ROWNUM <= 80) WHERE RN > 72;

?

结果前两页查询语句得到的结果是一样的,第三个结果就和前面的不一样。

?

百思不得其解啊,求各位大神给予指点。

?

数据文件在附件中。