Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Specifying the maximum number of rows retrieved from a query?
Judy Lam wrote:
>
> Is there a way specify the number of rows retrieved from a query?
>
> I have a table that stores article information. I want to retrieve the
> two latest articles.
Try something like:
SELECT A.COLX FROM DATABASE.TABLENAME A WHERE A.DATE > TO_DATE('DD-MON-YY') AND ROWNUM < 3; make sure 'DD-MON-YY' is two days ago. You could also be a little more general and use a where clause like WHERE A.DATE > (SYSDATE - 2), I guess it depends on you application....
-Shannon
-- Shannon J. O'Brien mailto:shannon_at_compusult.nf.ca Programmer/Analyst http://www.compusult.nf.ca Compusult Ltd. Mount Pearl, NF (Developers of CIDAS)Received on Thu Jan 30 1997 - 00:00:00 CST