tags:

views:

797

answers:

3

what is the format for using top keyword in oracle 9i? i have to retreive top 10 records..

+2  A: 

Use the RANK function as in...

select
   *
from
   (select empno,sal,rank()
    over (order by sal desc ) rnk
    from emp)
where rnk <= 5;

query was taken from here

Konstantinos
+1 for solution that works with Oracle 9i. ROWNUM is not supported in 9i.
Bill Karwin
+1  A: 

You can use the rownum keyword

SELECT * FROM (your ordered query)  WHERE ROWNUM <= 10
CMS
A: 

select column1,column2 from tbl1 where rownum<=10

nils_gate