Select * from ( Select rownum rn,t.* from table t) Where rn>&minnum and rn<=&maxnum 或者 Select * from ( Select rownum rn,t.* from table t rownum<=&maxnum) Where rn>&minnum
SQL>create table test as select * from dba_objects;
SQL>insert into test select * from test;
SQL> select count(*) from test COUNT(*) ---------- 831104
SQL> select * from (
2 select rownum rn,t.* from test t)
3 where rn>0 and rn <=50;
已选择50行。
已用时间: 00: 00: 01.03
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=10 Card=65 Bytes=12350)
1 0 VIEW (Cost=10 Card=65 Bytes=12350)
2 1 COUNT
3 2 TABLE ACCESS (FULL) OF 'TEST' (Cost=10 Card=65 Bytes=5590)
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
10246 consistent gets
0 physical reads
0 redo size
……
SQL> select * from (
2 select rownum rn,t.* from test t
3 where rownum <=50)
4 where rn>0;
已选择50行。
已用时间: 00: 00: 01.00
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=10 Card=50 Bytes=9500)
1 0 VIEW (Cost=10 Card=50 Bytes=9500)
2 1 COUNT (STOPKEY)
3 2 TABLE ACCESS (FULL) OF 'TEST' (Cost=10 Card=65 Bytes=5590)
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
82 consistent gets
0 physical reads
0 redo size
……
SQL> select * from (
2 select rownum rn,t.* from test t
3 where rownum <=10000)
4 where rn>9950;
已选择50行。
已用时间: 00: 00: 01.01
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
2616 consistent gets
0 physical reads
0 redo size
……
SQL> select * from (
2 select rownum rn,t.* from test t
3 where rownum <=800000)
4 where rn>799950;
已选择50行。
已用时间: 00: 00: 01.03
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
10242 consistent gets
0 physical reads
0 redo size
……
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有