Porting from ODP.NET to dotConnect - what's the equivalent of the OracleParameter.CollectionType property?

StackOverflow https://stackoverflow.com/questions/8540783

Question

I'm porting a bunch of code from the ODP.NET drivers to DevArt dotConnect for Oracle. I ran into the following code that no longer compiles:

OracleParameter parameter = new OracleParameter("state", OracleDbType.Number);
parameter.CollectionType = OracleCollectionType.PLSQLAssociativeArray; //Red Squiggly
parameter.Direction = ParameterDirection.Input;
parameter.Value = State.ToArray();
parameter.Size = State.Count;
command.Parameters.Add(parameter);

It seems Devart.Data.Oracle.OracleParameter doesn't have a CollectionType property. What should I be using here instead?

Was it helpful?

Solution

From here:

Devart.Data.Oracle.OracleParameter does not have the CollectionType property. If you set the Devart.Data.Oracle.OracleParameter.ArrayLength, then this parameter will be PL/SQL AssociativeArray (PL/SQL Table). For more details please refer http://www.devart.com/dotconnect/oracle/docs/?PlSqlTable.html

In short: just set ArrayLength and Devart treats it automatically as PLSQLAssociativeArray

Your code should thus be:

OracleParameter parameter = new OracleParameter();
parameter.ParameterName = "state";
parameter.Direction = ParameterDirection.Input;
parameter.OracleDbType = OracleDbType.Number; 
parameter.ArrayLength = State.Count;
parameter.Value = State.ToArray();
command.Parameters.Add(parameter);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top