|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55249 OCI-collection->append does not reflect NLS_NUMERIC_CHARACTERS settings
Submitted: 2011-07-20 08:05 UTC Modified: 2011-11-08 22:12 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: stloukal at programator dot cz Assigned:
Status: Suspended Package: OCI8 related
PHP Version: 5.3.6 OS: Linux/Fedora 14
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:
Solve the problem:
4 + 8 = ?
Subscribe to this entry?

 [2011-07-20 08:05 UTC] stloukal at programator dot cz
After connection to Oracle database script runs alter session command to change NLS_NUMERIC_CHARACTERS (',' is decimal separator and '.' is thousands separator). But using the OCI-Collection->append procedure on collection of numbers, all decimals are stripped (the input values into OCI-Collection->append procedure use comma as decimal separator - along to current NLS setting).

Function oci_bind_by_name reflects NLS setting well.

Test script:
sqlplus> CREATE TYPE username.num_tab IS TABLE OF NUMBER(8,5);


$i_con = oci_connect('username', 'password', 'localhost/devel1');

$i_rs = oci_parse($i_con, "ALTER SESSION SET NLS_NUMERIC_CHARACTERS = ',.'");
oci_execute($i_rs, OCI_DEFAULT);

$i_col = oci_new_collection($i_con, 'NUM_TAB', 'USERNAME');

$i_rs = oci_parse(
        l_nums      username.num_tab := :nums;
        raise_application_error(-20000, 'First number in collection is: ' || l_nums(1));
oci_bind_by_name($i_rs, ':nums', $i_col, -1, SQLT_NTY);
oci_execute($i_rs, OCI_DEFAULT);


Expected result:
Warning: oci_execute() [function.oci-execute]: ORA-20000: First number in collection is: 1,2 ORA-06512: at line 4 in...

Actual result:
Warning: oci_execute() [function.oci-execute]: ORA-20000: First number in collection is: 1 ORA-06512: at line 4 in...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-04 23:43 UTC]
PHP OCI8 currently converts the string '1,2' using zend_strtod which isn't Oracle 
NLS aware.
 [2011-11-08 22:12 UTC]
-Status: Open +Status: Suspended
 [2011-11-08 22:12 UTC]
After discussions with the Oracle C API team, I've logged an
enhancement against Oracle (#13361389) to enhance the C API to allow
this.  This is a non trivial enhancement because it impacts the
overall ethos of the C API and would require adding a whole new set of
API function calls.  I'm suspending this bug for the moment.  It can
be reviewed once Oracle's C OCI8 API have support for the behavior.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 12:01:28 2024 UTC