|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45039 OCI get number column length returns zero (0)
Submitted: 2008-05-19 19:00 UTC Modified: 2016-03-08 01:03 UTC
From: smelban at norwood dot com Assigned: sixd (profile)
Status: Closed Package: OCI8 related
PHP Version: 5.2.6 OS: Windows 2003 Enterprise Server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: smelban at norwood dot com
New email:
PHP Version: OS:


 [2008-05-19 19:00 UTC] smelban at norwood dot com
We just recently upgraded from Oracle 10g to Oracle 11g.  Since that move the ocicolumnscale and ocicolumnprecision functions have stopped returning the column length.  

Windows 2003 Enterprise Server
Zend Core 2.5.0
PHP 5.2.5

Reproduce code:
//  mynumber field is a 10,4 decimal
$sql = "SELECT mynumber FROM TABLENAME";
$R = OCIParse($c, $sql);
while (OCIFetch($R)) {
     $column_type  = ocicolumntype($R, $i);
     if( $column_type == "NUMBER" )
          print ocicolumnscale($R, $i ) . "\n";
          print ocicolumnprecision($R, $i ) . "\n";

Expected result:
Should Return


Actual result:



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-20 15:58 UTC]
What's the version of the Oracle client libraries used by PHP?
What platform is the DB on?
Are client/server 32bit or 64bit?
What does phpinfo() show for the OCI8 "Revision"? (The problem could be related to
 [2008-05-20 17:07 UTC] smelban at norwood dot com
I've connected my code to both an 10g and 11g database the they both are returning the same incorrect data.  Is there a way for me to debug what is actually being returned? 

I've looked in the all_tab_columns table in both a 10g and 11g databases and the information is correct.  I'm also looking at a VARCHAR2  field that returns 0 as the field size.  In the table it shows it as a 18 char string but both ocicolumnscale(..) and ocicolumnprecision(..) return 0 and 0;

I've found a workaround for myself by querying the the all_tab_columns table but that is just a work around.  I 100% certain this worked months back but only assumed it was the 11g issue.  I'm not quite sure how to proceed on finding out what is wrong.

Oracle Client

Oracle Server
Windows 2003 Enterprise Server 32 Bit

OCI8 Info
Revision is: $Revision: $
Version: 1.2.3
 [2008-05-21 21:41 UTC]
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at

In your version of OCI8 you don't have the fix for

(i) try testing with PHP 5.2.6+ from
(ii) ping Zend about updating OCI8 in ZCO (this is planned, but the schedule might have changed recently)
 [2016-03-08 01:03 UTC]
-Package: Oracle related +Package: OCI8 related -Assigned To: +Assigned To: sixd
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 00:01:28 2024 UTC