my scenario
i'm using ODP.NET oracle provider with c# 3.5, and i am trying to pass an array as parameter for a procedure...like this:
var paramNames = new OracleParameter();
paramNames.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
paramNames.ParameterName = "P_JOB_TITLE";
paramNames.Size = 2;
paramNames.Value = new string[2]{ "name1", "name1" };
cmd.Parameters.Add(paramNames);
when runtime code goes to paramNames.Value = new string[2]{ "name1", "name1" }; it catch with this error
"Value does not fall within the expected range"
Can anyone fix it?
ADDITIONAL INFO
Specifying OracleDbType the error is fixed, but executing give me some errors
paramNames.OracleDbType = OracleDbType.Varchar2;
"Unable to cast object of type 'System.String[]' to type 'System.IConvertible'."
my goal is to do something like this
http://aspalliance.com/621_Using_ODPNET_to_Insert_Multiple_Rows_within_a_Single_Round_Trip.3
ANOTHER PROBLEM WITH OUT PARAMETER
Inserting an out parameter like this
paramNames = new OracleParameter();
paramNames.ParameterName = "O_JOB_ID";
paramNames.Size = 3;
paramNames.Direction = ParameterDirection.Output;
paramNames.OracleDbType = OracleDbType.Int32;
paramNames.Value = new int[3] { 0, 0, 0 }; ;
cmd.Parameters.Add(paramNames);
it is correctly filled when ExecuteNonQuery finished. For example the pls-sql procedure performs 3 inserts and i return the row-id of each array record.
But i something goes wrong, for example isnerting the 2nd row, the entire OUT parameters (array) are always set on 0. I expected at least the params[0].value was enhanced
Thanks