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: Specifying the maximum number of rows retrieved from a query?

Re: Specifying the maximum number of rows retrieved from a query?

From: Shannon J. O'Brien <shannon_at_compusult.nf.ca>
Date: 1997/01/30
Message-ID: <32F0A181.167E@compusult.nf.ca>#1/1

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

Original text of this message

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