title: using PL/SQL assoc array index by varchar2 in C#
body: <p>I have PL/SQL code:</p>
  
  <pre><code>create or replace 
  package        TEST_PKG2 as
    type AssocArray is table of varchar2(20) index by binary_integer;
    type AssocArray_varchar is table of varchar2(20) index by varchar2(10);
    --type AssocArray_varchar is table of varchar2(20) index by integer;
  
    function assoc_arry_return(Param1 in AssocArray) return AssocArray_varchar;
  end TEST_PKG2;
  
  create or replace 
  package body        TEST_PKG2 as 
    function assoc_arry_return(Param1 in AssocArray) return AssocArray_varchar
      is
    v_return_value AssocArray_varchar;    
    begin
      v_return_value('name1'):=Param1(1);
      v_return_value('name2'):=Param1(2);
      v_return_value('name3'):=Param1(3);
  
      return v_return_value;
    end assoc_arry_return;
  end TEST_PKG2; 
  </code></pre>
  
  <p>controle code to check pl/sql:</p>
  
  <pre><code>set serveroutput on
  declare
    assoc_array test_pkg2.AssocArray;
    assoc_array_return test_pkg2.AssocArray_varchar;
  
  begin
    assoc_array(1):='test1';
    assoc_array(2):='test2';
    assoc_array(3):='test3';
    assoc_array_return:= test_pkg2.assoc_arry_return(assoc_array);
    dbms_output.put_line(assoc_array_return.first||' - '||assoc_array_return(assoc_array_return.first));
  end;
  </code></pre>
  
  <p>and C# code for execute this function:</p>
  
  <pre><code>command = new OracleCommand("TEST_PKG2.assoc_arry_return", OracleConnection);
                  command.CommandType = CommandType.StoredProcedure;
                  OracleParameter return_value = new OracleParameter();
                  return_value.OracleDbType = OracleDbType.Varchar2;
                  return_value.Direction = ParameterDirection.ReturnValue;
                  return_value.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
                  return_value.Size=3;
                  return_value.ArrayBindSize = new int[3] { 20, 20, 20 };
                  command.Parameters.Add(return_value);
  
                  OracleParameter Param4 = command.Parameters.Add("Param1", OracleDbType.Varchar2);
                  Param4.Direction = ParameterDirection.Input;
                  Param4.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
                  Param4.Value = new string[3] { "First Element", "Second Element", "Third Element" };
                  Param4.Size = 3;
                  Param4.ArrayBindSize = new int[3] { 20, 20, 20 };
                  Param4.ArrayBindStatus = new OracleParameterStatus[3] { OracleParameterStatus.Success, OracleParameterStatus.Success, OracleParameterStatus.Success };
                  command.ExecuteNonQuery();
  </code></pre>
  
  <p>When I execute app with thic code, execution dies on last line with error "ORA-06550: Line 1, column 15:
  PLS-00382: expression is of wrong type
  ORA-06550: Line 1, column 7:
  PL/SQL: Statement ignored"</p>
  
  <p>This is a special case, when I use assoc array indexed by varchar2.
  when I change index by of return type in package on integer (commented out line code id package), all is OK.</p>
  
  <p>Do you have any idea how use this package in C#?</p>
  
  <p>Thank's </p>