mysql limit改为oracle 分页

mysql中的sql语句:

select * from 表名 limit 0,10;

换成Oracle,相应功能的语句为:表示取表中的前10条数据(从第1条开始,取10条)

select * from 表名 where rownum <= 10 ;

如果取[5,10]条,则,oracle语句写法有两种:

(1)
select   *   from   table   where   rownum<=10 
minus
select   *   from   table   where   rownum<5 ;
(2) 
select * 
from ( select rownum r,a.* 
       from table a 
       where rownum<=10 ) 
where r>=5;
因为rownum不支持>=操作,所以,要先将rownum实例化。
经测试,第二种写法,比第一种写法的效率要高。