.net equivalent of Java's Statement.setArray

I have oracle table and i am trying to run a select statement -
select * from mytable where id in { .... }

I need to pass the list of IDs as an oracleparameter. Because if i just put the list of  ID as string and if SQL Statement becomes very long it will crash...

So i am trying pass integer array as an oracle parameter
dim myidlist() as integer
Dim oraparobjlist As OracleParameter
oraparobjlist = New OracleParameter("myidlist", OracleType.?????)
But it does not work...

I know in java we can do something like this-
statement stmt;
stmt.setArray(1, myidlist)  
How i can do that in .NET ? is it possible ?

at999Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ToddBeaulieuCommented:
I'm not into Oracle, but a search for "OracleParameter array" turned up quite a bit of material that should get you there.

http://forums.oracle.com/forums/thread.jspa?messageID=3650465


cmd.CommandType = CommandType.StoredProcedure;OracleParameter[] 
oparams = new OracleParameter[2];
oparams[0] = cmd.Parameters.Add("param2", OracleDbType.Int32, DBNull.Value, ParameterDirection.ReturnValue);
int[] vals = new int[] { 1, 2, 3, 4, 5 };oparams[1] = cmd.Parameters.Add("param1", OracleDbType.Int32, vals.Length, vals, ParameterDirection.Input);oparams[1].CollectionType = OracleCollectionType.PLSQLAssociativeArray;
cmd.ExecuteNonQuery();

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
at999Author Commented:
Thanks ToddBeaulieu,

I want to get the Resultset out of it i donot want to run an executenonquery - i want to put that resultset for my DataGrid.
0
caga79Commented:
Since you mentioned that the IID list can become very long you can use the following:

Have your query defined on Oracle  as an Oracle PL/SQL procedure, that would return a t_cursor, and call that query within your code using the OracleDataReader Class. Your could even break it down into two pieces if you wanted to.So your .Net code would be something like:
while (myID.Read())
{

   <set the value of the ID you want for mySelectStatement here>

   while (mySelectStatement.Read())
    {
      <Your code goes here>
    }
}

Open in new window

0
at999Author Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.