php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74195 OCI_BIND_BY_NAME dates problem
Submitted: 2017-03-02 09:26 UTC Modified: 2017-03-02 11:24 UTC
From: wgizynski at gmail dot com Assigned:
Status: Open Package: PDO OCI
PHP Version: 7.1Git-2017-03-02 (Git) OS: Windows2008 server
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-03-02 09:26 UTC] wgizynski at gmail dot com
Description:
------------
I think there is a problem with binding variables with condition to Date columns in oracle sql.
It gives ORA-01722 invalid number. With numbers and varchars everything is ok.
Putting directly in sql without binding gives a result.
PHP Version 7.1.1
Oracle Run-time Client Library Version 	12.1.0.2.0 


Test script:
---------------
...
TO_DATE(:ON_DATE,'YYYY-MM-DD') BETWEEN x.fromdate AND x.todate
...
$onDate = '2017-03-02';
oci_bind_by_name($stid, ":ON_DATE", $onDate)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-02 11:24 UTC] wgizynski at gmail dot com
I have found a reason of my troubles.
IN SQL was another condition:
...
AND upr.user_id = :USER_ID
...
I was binding not variable, but method result. ($User->getUserId()).
There is notice that I shouldn't do that.
This is the reason why next bind of date variable gives such error.
I think it shouldnt looks like this, its veery confusing.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Wed Oct 17 11:01:25 2018 UTC