|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77764 Binding of SQLT_NUM variable resolves as NULL in SQL
Submitted: 2019-03-18 14:11 UTC Modified: -
From: m dot a dot ogarkov at gmail dot com Assigned:
Status: Open Package: OCI8 related
PHP Version: 7.3.3 OS: Linux
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: m dot a dot ogarkov at gmail dot com
New email:
PHP Version: OS:


 [2019-03-18 14:11 UTC] m dot a dot ogarkov at gmail dot com
When binding with SQLT_NUM type, we get NULL in sql/plsql.
Variables is converted to INT, why int? 

Test script:

$handle = oci_connect(getenv("DB_USER"), getenv("DB_PASSWORD"), getenv("DB_HOST"));
$var = 15.123;
$st = oci_parse($handle, "SELECT :0 FROM DUAL");
oci_bind_by_name($st, ":0", $var, -1, SQLT_NUM);

Expected result:
we should get NUMBER sql type:
"15.123" => (float) 15.123
"15" => (float) 15

Actual result:
array(2) {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-26 19:55 UTC] camporter1 at gmail dot com
The basic issue is that SQLT_NUM is treated just like SLQT_INT, which allows long values only.

For proper handling of doubles (which involves behind the scenes changing them into a string) I'd recommend using SQLT_LNG, or not providing the type at all which does the same thing.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu May 13 13:01:23 2021 UTC