php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #13907 Oracle Fetch row by row number
Submitted: 2001-11-02 05:37 UTC Modified: 2006-04-03 09:57 UTC
From: jh at synergy dot cx Assigned: maxim (profile)
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.0.6 OS: all
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jh at synergy dot cx
New email:
PHP Version: OS:

 

 [2001-11-02 05:37 UTC] jh at synergy dot cx
Currently there's no way of fetching a row by row number.
OCIFetchStatement() fetches all rows returned by a query. 
OCIFetchInto() only allows to return the NEXT row.

It would make sense to be able to selectively fetch a subset of rows or single rows by row number for large
row lists.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-29 08:59 UTC] maxim@php.net
Well, this wouldn't make much sence as this should be controlled by your SQL. What's the point to grab the whole table in your buffer to then fetch only a few rows somewhere in the middle?

Anyhow, will assign it to myself for now.
 [2003-01-29 12:07 UTC] michael dot mauch at gmx dot de
Probably he/she doesn't really need a new function, but only a hint how to simulate the limit/offset syntax of MySQL/Postgresql.

Without the help of <http://www.dclp-faq.de/q/q-oracle-limit.html> (in German, but not much text), I certainly would not know how to do it, although I asked our local SQL gurus.
 [2003-01-30 06:23 UTC] maxim@php.net
It is probably true. Will soon close it as bogus. I am still curious to see whether there is any "technical" way for it through OCI first.
 [2003-01-30 06:29 UTC] maxim@php.net
Just to follow up:

Yes, to select the first 6 rows you can use subselects (besides there are other methods):

SELECT * FROM
  (SELECT ename, hiredate FROM emp ORDER BY hiredate)
WHERE ROWNUM < 6

Nevertheless, you still have selected the full stream in the subselected query *and* from the received result you've extracted the first 6 rows.

What I am wondering here is, whether it could actually make any sense of having the offset functions that pretty much limit the Fetch loop inside OCI8 extension.

Doesn't seem to me a clean method, but if this saves on speed and functionality/usability there is then a space for this function.

Will look into it in details
 [2006-04-03 09:57 UTC] tony2001@php.net
Yes, you have to emulate LIMIT in Oracle using 3 nested SELECTs. This is the way it works.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 05:01:27 2024 UTC