php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49239 oci_bind_array_by_name does not work with associative arrays
Submitted: 2009-08-12 19:09 UTC Modified: 2017-10-24 07:50 UTC
Votes:16
Avg. Score:4.2 ± 0.9
Reproduced:12 of 13 (92.3%)
Same Version:7 (58.3%)
Same OS:4 (33.3%)
From: twhite at goldenspiral dot us Assigned:
Status: Open Package: OCI8 related
PHP Version: 5.3SVN-2009-08-12 (snap) OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: twhite at goldenspiral dot us
New email:
PHP Version: OS:

 

 [2009-08-12 19:09 UTC] twhite at goldenspiral dot us
Description:
------------
oci_bind_array_by_name only works on arrays with numeric indices, and not on associative arrays.  Oracle 9+ supports associative array data types indexed by varchar2.

Configure line:
cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--disable-isapi" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk,shared"

Reproduce code:
---------------
/* PHP */
$conn = oci_connect($username, $password, $database);
$rows = array(
                  'COL1'    =>  'foo',
                  'COL2'    =>  'baz',
                  'COL3'    =>  'bar'
);
$s = oci_parse($conn, "begin ARRAY_BIND_TEST.INSERT_PROC(:a); end;");
oci_bind_array_by_name($s, ":a", $rows, count($rows), -1, SQLT_CHR);
oci_execute($s);

/* Oracle */
create or replace
package ARRAY_BIND_TEST as
  type array_assoc is table of varchar2(500) index by varchar2(4000);
  procedure INSERT_PROC(p_arr in array_assoc);
end ARRAY_BIND_TEST;

create or replace
package body ARRAY_BIND_TEST as
  procedure INSERT_PROC(p_arr in array_assoc) is
  begin
    insert into ZZZ_TEST_TABLE (col1, col2, col3)
    values (
        p_arr('COL1'),
        p_arr('COL2'),
        p_arr('COL3')
      );
  end INSERT_PROC;
end ARRAY_BIND_TEST;

Expected result:
----------------
I am expecting the stored procedure to execute.

Actual result:
--------------
Warning: oci_execute() [function.oci-execute]: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'INSERT_PROC' ORA-06550: line 1, column 7: PL/SQL: Statement ignored in ...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-24 07:50 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: sixd +Assigned To:
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 15:01:27 2025 UTC