Get SELECT results with anonymous pl/sql block and with OracleParameter
384482Dec 23 2003 — edited Jan 9 2004
I want to bind parameters to command, then pass an array of ids and then get back the results from the SELECT-based statement.
My query is like "begin select value into :param1 from mytable where id = :id; end;
The code snippet is like:
OracleCommand cmd = new OracleCommand(query, Connection);
OracleParameter p1 = new OracleParameter("param1", ...);
p1.Direction = ParameterDirection.Output;
p1.Value = values;
OracleParameter p2 = new OracleParameter("id", ...);
p1.Direction = ParameterDirection.Output;
p1.Value = ids;
where ids is declared as int[] ids
cmd.ArrayBindCount = ids.Length;
cmd.ExecuteNonQuery();
Upon execution, I cannot get back the results of statement from values array.
What's wrong with my code? Is there any my failures?
I have seen a lot of snippets, including samples with ODP.NET exemplifying arraybinding feature but with INSERT/UPDATE/STOREDPROC statements, but saw this way can be done SELECT statement.