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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
49 + 4 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 08:01:31 2024 UTC