|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1970 OCIColumnName can only be called BEFORE OCIFetchInto
Submitted: 1999-08-05 10:41 UTC Modified: 2006-07-17 08:06 UTC
From: jjl at mars dot tuwien dot ac dot at Assigned:
Status: Closed Package: OCI8 related
PHP Version: 3.0.12 OS: Linux RH 5.2 i386
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.
Block user comment
Status: Assign to:
Bug Type:
From: jjl at mars dot tuwien dot ac dot at
New email:
PHP Version: OS:


 [1999-08-05 10:41 UTC] jjl at mars dot tuwien dot ac dot at
If you try to do
$colname = OCIColumnName($stmt, $i)
AFTER you have called OCIFetchInto(...) then $colname will be empty.
If you call it BEFORE OciFetchInto everything works as it should.
This behaviour gave me a headache for a few hours...

So the correct way to do it should be:
$stmt = OCIParse($query)
for ($i=1; $i <= number of columns; $i++) {
	$colname[$i] = OCIColumnName($stmt, $i);
while (OCIFetchInto(....)) {
  // do smthng with the actual data


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1999-08-05 16:01 UTC] mbritton at cvs dot php dot net
This is true only if you fetch all the way to the end of the result set using repeated OCIFetchInto's before calling the OCIColumnName.  It's like the cursor attributes go away once the last row is fetched.  This may be a product of Oracle's OCI routines.
 [1999-08-06 01:55 UTC] thies at cvs dot php dot net
this is an unexpected side-effect of my implementation of ref-cursors. please consider a cursor more-or-less "closed" after you read all the rows. if you really need it please open a change-request.
 [2016-07-08 21:13 UTC]
Automatic comment from SVN on behalf of rasmus
Log: Engine karma for Keyur for PR #1970 and others
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Oct 02 07:01:24 2023 UTC