Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: returning certain rows from a SELECT
I'll refrain from giving you the lecture about the real meaning of 'rows 26
to 50' in a data table and assume that the table in question is sorted in
the order you want.
If so......
select f.rn, field_1, field_2
from (select rownum rn, field_1, field_2 from foo) f
where f.rn between 26 and 50;
should work for you.
Mark
Neil Kandalgaonkar wrote in message <7m38lt$ans$1_at_newsflash.concordia.ca>...
>Hello, I'm new to Oracle, maybe my approach here is completely wrong,
>but here's my problem:
>
>I am using Oracle8 through Perl's DBI. I would like to obtain specific
>row-ranges from my SELECT statements, i.e., give me rows 26-50 of 'SELECT
>* FROM foo'.
>
>I can get this to work nicely in SQLPLUS using a cursor, loop, and
>%ROWCOUNT, but these results are all printed to the screen, inserted into
>a temporary table, or something similar.
>
>How can I make a function (?) or something similar (?) that will return
>rows that DBI will understand?
>
>I imagine something like
>
>"SELECT * FROM complicated_query(26,50)"
>
>or even
>
>"SELECT * FROM slice_query('SELECT foo,bar FROM quux',26,50);
>
>and while I could construct the query with the dbms_sql package,
>I'm not sure how to make the procedure or function return the rows.
>
>or is there a way to get Perl/DBI to understand dbms_output lines?
>
>Thanks in advance.
>
>
Received on Fri Jul 09 1999 - 07:35:29 CDT
![]() |
![]() |