Re: SQL statement question

From: Ram Lakshminarayanan <raml_at_india.hp.com>
Date: Tue, 31 Jul 2001 10:34:58 +0530
Message-ID: <3B663C7A.9EFFC388_at_india.hp.com>


I believe there is a rank feature in Oracle 8.x and above to accomplish your task. The rank feature can be used in a SELECT statement.

Please verify syntax.

cheers
- Ram

Anand wrote:

> "Nicholas Mudie" <nmudie_at_chello.com> wrote in message news:<JAIX6.100067$2f1.6172213_at_amsnews02.chello.com>...
> > Hello,
> >
> > I want to return the first 50 rows of my sql statement results. How do I do
> > this???
> >
> > I have hundreds of rows that are resturned in my CGI script but I only want
> > 50 per page.
> >
> > Cheers,
> > Nicholas Mudie
> > CHELLO BROADBAND
>
> for returing the first 50 rows it is better if you use a cursor. I
> would not suggest usage of row num because row num is assigned after
> the selection. so the rownum for a record mey be different in
> different select statements.
>
> try this
>
> declare
> cursor c1 is select ename from emp;
> begin
> for i in c1 loop
> if c1%rowcount=50 then
> dbms_output.put_line(i.ename||'is the 50th name!');
> end if;
> end loop;
> end;
>
> now you can try adapting this logic to your specific platform
>
> regards,
> anand
Received on Tue Jul 31 2001 - 07:04:58 CEST

Original text of this message