Re: Simple Question!

From: David Scott <dscott_at_is.net>
Date: 1995/04/29
Message-ID: <dscott-2904952214560001_at_dscott.is.net>#1/1


In article <3nio5g$1j7_at_dcsun4.us.oracle.com>, cgohring_at_uk.oracle.com wrote:

> tmaxwell_at_crl.com (Anthony B. Cillo) writes:
> : I am trying to find the oldest 1000 patients in our database. The
> : problem is that I cannot get the system to stop after returning 1000
> : rows. I have tried using rownum but that only works if you are not
> : using order by.
> :
> : Any ideas?
> :
> Use a PL/SQL block
>
>

The solution is easier than you think:

CREATE VIEW OLDEST_PATIENTS as
  SELECT patient_name,age
  FROM patient_info
  ORDER BY age DESC
/
SELECT * from OLDEST_PATIENTS
  WHERE rownum <= 1000
/

Hope this helps!



David Scott
...how can I keep from singing?
email: dscott_at_is.net
Received on Sat Apr 29 1995 - 00:00:00 CEST

Original text of this message