note 124325 added to function.oci-bind-by-name
| From: | asui dot dev dot null at gmail dot com | Date: | Tue, 22 Oct 2019 23:20:26 +0000 |
| Subject: | note 124325 added to function.oci-bind-by-name | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-212751@lists.php.net to get a copy of this message | ||
If you are getting "ORA-01722: invalid number error" while inserting/updating a FLOAT
value into a NUMBER column, please check the correctness of a binded value format according to the
current locale settings.
Default "american" locale assumes that value send to oracle will be a dot decimal
separator (just like 4127.5). But with setlocale('pl_PL.UTF-8') your float number would be
represented as 4127,5 and that form will be used while sending data do oracle causing a problem...
That was my case (8 hours of debugging).
You can check your current locale with setlocale(LC_ALL, 0).
What I can recommend as a solutions:
a) do not set locale, or set it to 'C' for a time of sending data;
b) convert float to a string format compatible with current oracle session NLS_NUMERIC_CHARACTERS
parameter value.
For example: when NLS_NUMERIC_CHARACTERS = '.,' float value 4127.5 should be converted to
'4127.5'. Then oracle will catch it correctly even if current locale are set differently.
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.168 (proxied: 95.41.57.74)
----
Manual Page -- http://php.net/manual/en/function.oci-bind-by-name.php
Edit -- https://master.php.net/note/edit/124325
Del: integrated -- https://master.php.net/note/delete/124325/integrated
Del: useless -- https://master.php.net/note/delete/124325/useless
Del: bad code -- https://master.php.net/note/delete/124325/bad+code
Del: spam -- https://master.php.net/note/delete/124325/spam
Del: non-english -- https://master.php.net/note/delete/124325/non-english
Del: in docs -- https://master.php.net/note/delete/124325/in+docs
Del: other reasons-- https://master.php.net/note/delete/124325
Reject -- https://master.php.net/note/reject/124325
Search -- https://master.php.net/manage/user-notes.php