首页 > 代码库 > oracle分页查询sql语句

oracle分页查询sql语句

String sql="select * from( select e.*,rownum r from( select * from emp order by sal desc )e ) where r between ? and ? ";

String sql="select * from( select e.*,rownum r from( select * from emp order by sal desc )e ) where r between 6 and 10 ";

 

StringBuilder vs = new StringBuilder();
vs.append("select * from (");
vs.append("select e.*, rownum RNO from (select * from emp order by sal desc) e ");
vs.append(")");
vs.append("where RNO between ? and ? "); //动态的SQL语句。

String sql = vs.toString();

oracle分页查询sql语句