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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: wgizynski at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC