WEB开发网
开发学院数据库Oracle Oracle的翻页Sql语句 阅读

Oracle的翻页Sql语句

 2007-06-02 16:09:03 来源:WEB开发网   
核心提示:StringBuffer pagingSelect = new StringBuffer(100); pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");pagingSelect.append(sq

StringBuffer pagingSelect = new StringBuffer(100); pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");
pagingSelect.append(sql);
pagingSelect.append(" ) row_ where rownum <= " + endRow + ") where rownum_ > " + startRow);

startRow 是记录开始处
endRow 是记录结束处

举例来说:
从第11条到第20条

select * from (

select row_.*, rownum rownum_ from (

select person_id, chn_name, chn_firstname_py from t_pbase_info

) row_ where rownum <=20

) where rownum_ >=11

Tags:Oracle Sql 语句

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接