php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35280 BINARY_FLOAT type is null in oci_fetch_assoc & oci_fetch_array
Submitted: 2005-11-18 18:13 UTC Modified: 2005-11-21 18:26 UTC
From: tawood at vlsmaps dot com Assigned: tony2001 (profile)
Status: Not a bug Package: OCI8 related
PHP Version: 5.0.5 OS: Fedora 4
Private report: No CVE-ID: None
 [2005-11-18 18:13 UTC] tawood at vlsmaps dot com
Description:
------------
I have php 5.0.5, apache 2.0.55 and oci8-beta 1.1.1. 

BINARY_FLOAT data types in 10g are always returned as a null value in php. I have made sure that the values are there via SQL*Plus and the Enterprise Manager.

In the below example, the output of the binary_float column is empty.

The obvious work around to this is to use a NUMBER data type.

Reproduce code:
---------------
------------
$oraDb = oci_connect("YOUR_SCHEMA","password","TNSNAME");
$oraCreate = 'CREATE TABLE binf_test (bt_idx INTEGER, reg_float NUMBER (10, 3), bin_float BINARY_FLOAT, CONSTRAINT bt_pk PRIMARY KEY (bt_idx))';
oci_execute(oci_parse($oraDb, $oraCreate));
for($i=0;$i<10;$i++) {
        $decnum = ($i / (.429));
        $oraInsert = "INSERT INTO binf_test VALUES (".$i.", ".$decnum.", ".$decnum.")";
        oci_execute(oci_parse($oraDb, $oraInsert));
}
$oraSelect = "SELECT * FROM binf_test";
$oraParse = oci_parse($oraDb, $oraSelect);
if (oci_execute($oraParse)) {
        while ($oraRow = oci_fetch_assoc($oraParse)) {
                foreach ($oraRow as $key => $val) {
                        echo $key." : ".$val."<br />\n";
                }
        }
}
oci_close($oraDb);

Expected result:
----------------
The correct values of binary_float columns to be displayed.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-18 21:49 UTC] tony2001@php.net
And even using the same version of Oracle Instant Client, I still get the same result.
Please try OCI8 from PECL CVS.

 [2005-11-21 17:51 UTC] tawood at vlsmaps dot com
You can close this bug. I didn't "really" have 1.1.1 installed, I just thought I did (I had no idea how to use PECL). Thanks for the fast response, it is greatly appreciated.
 [2005-11-21 18:26 UTC] sniper@php.net
Closed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 19:01:30 2024 UTC