这段时间,公司有个新项目其数据库使用Oracle,对原先支持SQL Server数据源的列表控件进行了调整,现把分页使用的静态SQL语句提供如下:
--按code,num列正序排列的1-15条数据 第1页
SELECT code,num,title,contents,remark,snum FROM
(
SELECT ROWNUM QDZHBSH_RECNO,code,num,title,contents,remark,snum FROM
(SELECT code,num,title,contents,remark,snum FROM sys_code ORDER BY code,num asc)
WHERE ROWNUM <= (1 + 15 - 1)
ORDER BY ROWNUM ASC
)
WHERE QDZHBSH_RECNO BETWEEN 1 AND (1 + 15 - 1)
--按code,num列正序排列的16-30条数据 第2页
SELECT code,num,title,contents,remark,snum FROM
(
SELECT ROWNUM QDZHBSH_RECNO, code,num,title,contents,remark,snum FROM
(SELECT code,num,title,contents,remark,snum FROM sys_code ORDER BY code,num asc)
WHERE ROWNUM <= (16 + 15 - 1)
ORDER BY ROWNUM ASC
)
WHERE QDZHBSH_RECNO BETWEEN 16 AND (16 + 15 - 1)
--按code,num列正序排列的31-45条数据 第3页
SELECT code,num,title,contents,remark,snum FROM
(
SELECT ROWNUM QDZHBSH_RECNO, code,num,title,contents,remark,snum FROM
(SELECT code,num,title,contents,remark,snum FROM sys_code ORDER BY code,num asc)
WHERE ROWNUM <= (31 + 15 - 1)
ORDER BY ROWNUM ASC
)
WHERE QDZHBSH_RECNO BETWEEN 31 AND (31 + 15 - 1)