How from ASP.NET I can call a stored procedure in an Oracle package that accepts a VArray. The VArray will pass a list of keys that the stored procedure will use to modify appropriate records. I know I could send the keys in separate calls or send a delimited list, but I'd rather use an array.
Assuming you're using ODP.NET (you shouldn't be using System.Data.OracleClient
anyway), here's how to do it:
using System;
using System.Data;
using Oracle.DataAccess.Client;
class SomeClass
{
void SomeMethod(string connectionString, int[] anArrayOfKeys)
{
using (var con = new OracleConnection(connectionString))
using (var cmd = con.CreateCommand())
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "StoredProcedureNameGoesHere";
cmd.Parameters.Add(
"ParameterNameGoesHere",
OracleDbType.Array,
anArrayOfKeys,
ParameterDirection.Input);
con.Open();
cmd.ExecuteNonQuery();
}
}
}