ID:               49239
 Updated by:       j...@php.net
 Reported By:      twhite at goldenspiral dot us
-Status:           Open
+Status:           Assigned
 Bug Type:         OCI8 related
 Operating System: Windows XP
 PHP Version:      5.3SVN-2009-08-12 (snap)
 Assigned To:      sixd


Previous Comments:
------------------------------------------------------------------------

[2009-08-12 19:09:04] 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
...


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=49239&edit=1

Reply via email to