Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: limit

Re: limit

From: Bricklen Anderson <bricklen_at_shaw.ca>
Date: Tue, 22 Jan 2002 22:50:33 GMT
Message-ID: <3C4DEC43.22B03BBC@shaw.ca>


actually, look into the new (8i) analytic functions in SQL. what you may be looking for may be: row_number, rank, dense_rank, etc. Try the following if you're keen:

http://asktom.oracle.com/pls/ask/f?p=4950:8:425122::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:1941199930674,%7Banalytic%7D%20and%20%7Bfunctions%7D
http://asktom.oracle.com/pls/ask/f?p=4950:8:425122::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:750625651018,%7Banalytic%7D%20and%20%7Bfunctions%7D
http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a85397/function.htm#81409

Bricklen

Ed prochak wrote:
>
> "Michael L. Hostbaek" <michDEL_THIS_at_bsd.fr.eu.org> wrote in message news:<slrna4r0fh.1nbn.michDEL_THIS_at_freebsdcluster.dk>...
> > Michael L. Hostbaek tried to tell us something, and all I got was:
> > > Hello,
> > >
> > > from old mySQL usage, I seem to remeber that an output limit was
> > > possible in conjunction with the SELECT statement.. How would one go
> > > about that with Oracle/SQL ?
> > >
> >
> > Just to clearify, I *am* aware of the 'numrow' function. But I cannot
> > use 'numrow' together with 'order by' or 'asc/desc'
> >
> > Let us say I would like the ten last rows of a table - how would I do
> > that ?
>
> ORACLE doesn't have a 'numrow' function.
>
> But to answer your question, use:
>
> select * from yourtable where rownum <11;
>
> (Before your complain those are the first 10 rows, Please define what
> you means by LAST rows. Most people asking this question are thinking
> in terms of FILE based databases. ORACLE is a Relational database. In
> a relational database it doesn't make any sense to ask for the "last
> rows" of a table.)
>
> Finally, if you still really want to do this, look into using a cursor
> in PL/SQL.
Received on Tue Jan 22 2002 - 16:50:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US