AW: AW: AW: AW: [PHP-DB] php and OCI
| From: | Matthias Kopolt | Date: | Wed, 14 Feb 2001 08:11:12 +0000 |
| Subject: | AW: AW: AW: AW: [PHP-DB] php and OCI | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-6594@lists.php.net to get a copy of this message | ||
>and to get rows, say, from 20 to 40?
>Is it ok to write:
>"select * from (select * from table where foocondition order by foo) where
>rownum >= 20 AND rownum <= 40"
its not that easy, as oracle start counting with the first retrieved row, so
rownum > x will wait for ever, as oracle will never start counting because
no
rows are retrieved.
make a trick and select the rownum in a subquery, than you can treat it as a
fixed row:
select * from (
select rownum "rn", * from (select * from table where foocondition order by
foo)
)
where rn >= 20 AND rn <= 40
this should do it (although there are a lot of subqueries)