Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: limit
"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 - 11:30:38 CST
![]() |
![]() |