oracle sql分頁查詢(一)

wisdomone1發表於2010-07-30
14:36:47 SQL> select x.owner,x.object_name,x.object_id,x.status from (select rownum rn,a.* from test a) x where x.rn between 1 and 20;
Elapsed: 00:00:00.01
Execution Plan
----------------------------------------------------------
Plan hash value: 1984214786
----------------------------------------------------------------------------
| Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
----------------------------------------------------------------------------
|   0 | SELECT STATEMENT    |      |  1607K|   174M|  4992   (3)| 00:01:00 |
|*  1 |  VIEW               |      |  1607K|   174M|  4992   (3)| 00:01:00 |
|   2 |   COUNT             |      |       |       |            |          |
|   3 |    TABLE ACCESS FULL| TEST |  1607K|    64M|  4992   (3)| 00:01:00 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter("X"."RN"<=20 AND "X"."RN">=1)
 
 
 
 
Select
  Tname,
  Tabtype
FROM
  (Select
    Tname,
    Tabtype,
    Rownum Rn
  FROM
    (SELECT * FROM Tab ORDER BY Tname
    )
  WHERE rownum <=150
  )
WHERE rn>=100;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-669904/,如需轉載,請註明出處,否則將追究法律責任。

相關文章