I have a PL / SQL stored procedure that accepts 4 inputs. One of these inputs is an associative array (Oracle Type: Index table VARCHAR2 (1) by PLS_INTEGER).
I want to have a C # program that calls this stored procedure with corresponding inputs, including an associative array.
I am using ODP.net 11.2 with Visual C # 2010 Express and Oracle 11gR2.
I cannot find good examples of how to pass an array to a pl / sql procedure from C #. Can someone give me an example? After Oracle Documentation accurately gives me a message about the wrong number or type of arguments.
My C # 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();
My whole procedure is to keep a journal. I'm just trying to make this concept work.