ID:               32180
 Comment by:       KRomas at goldentele dot com
 Reported By:      snirh at inag dot pt
 Status:           Feedback
 Bug Type:         *Database Functions
 Operating System: WINDOWS SERVER 2003
 PHP Version:      4.3.10
 New Comment:

echo    '<PRE>';
        $res    =       $obj_oracle->Get_rows('SELECT   (-3/5) AS floatp FROM 
dual');
        $res2   =       $obj_oracle->Get_rows('SELECT   to_char(-3/5, 
\'09999.9999\') AS
floatp FROM dual');     
        var_dump($res);
        echo    $res[0]['FLOATP'] + 2;
        echo    '<BR>';
        echo    $res2[0]['FLOATP'] + 2;
-------------------
array(1) {
  [0]=>
  array(1) {
    ["FLOATP"]=>
    string(3) "-,6"
  }
}
2
1.4


Previous Comments:
------------------------------------------------------------------------

[2005-03-03 22:28:04] [EMAIL PROTECTED]

What does 'var_dump($result);' output?



------------------------------------------------------------------------

[2005-03-03 19:59:33] snirh at inag dot pt

Description:
------------
Using OCI libs to return values from a database, if this values is
negative floating point the result cannot be used as number!

Reproduce code:
---------------
$sql = "SELECT (-3/5) AS floatp FROM dual";
$conn2 = ocilogon("login", "pass", $srvc);
$stmt = ociparse($conn2, $sql);
ociexecute($stmt, OCI_DEFAULT);
while (ocifetch($stmt)) {
        echo $result = ociresult($stmt, "FLOATP")."\n\n";
 }
 echo $result + 2;

// This code return 2!!

Expected result:
----------------
1.4

Actual result:
--------------
2


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32180&edit=1

Reply via email to