title: C# 2010, ODP.net, call stored procedure passing array
body: <p>I have a PL/SQL stored procedure that takes 4 inputs. One of those inputs is an associative array (Oracle Type: Table of VARCHAR2(1) index by PLS_INTEGER). </p>
  
  <p>I want to have a C# program that calls this stored procedure with the proper inputs including the associative array.</p>
  
  <p>I am using ODP.net 11.2 with Visual C# 2010 Express and Oracle 11gR2.</p>
  
  <p>I cannot find any good examples of how to pass an array to a pl/sql procedure from C#. Can anybody give me an example? Following Oracle Documentation exactly gives me error saying Wrong number or type of arguments.</p>
  
  <p>My C# Code:</p>
  
  <pre><code>        OracleCommand cmd = new OracleCommand("begin sdg_test.sdg_test2(:1); end;", conn);
  
          OracleParameter Param1 = cmd.Parameters.Add("1", OracleDbType.Varchar2);
  
          Param1.Direction = ParameterDirection.Input;
  
          Param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
  
          Param1.Value = new string[22] { "Y", "Y", "N", "Y", "N", "Y", "Y", "Y", "Y", "Y", "N", "Y", "N", "Y", "Y", "Y", "Y", "Y", "N", "Y", "N", "Y" };
  
          Param1.Size = 22;
          Param1.ArrayBindSize = new int[22] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
  
          cmd.ExecuteNonQuery();
  
          conn.Close();
          conn.Dispose();
  </code></pre>
  
  <p>All my procedure does is log a message. I am just trying to get this concept to work. </p>