Re: SQL statement question
Date: Sat, 21 Jul 2001 21:55:26 GMT
Message-ID: <8324cc14.0106191757.55cb61a8_at_posting.google.com>
"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 Sat Jul 21 2001 - 23:55:26 CEST