i am trying to execute multiple oracle select query as explain at that post answer here but I am getting exception as show at image
the same way explained at oracle sit
Although you're using names for your parameters, your driver is treating them positionally. You can kind of tell because it's (almost) matching :1
with the name p_cr1
- '1' isn't a valid name. It doesn't complain since it matches positionally - but that means it's trying to use the P_para
for :1
, and as the type of that is wrong, that explains the error you see.
There may well be a way to change the driver's behaviour, but for now you can just swap the order you bind them - so the binds occur in the same order (position) the variables appear in the query. So:
cmd.Parameters.Add("p_cr1", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Output);
cmd.Parameters.Add(new OracleParameter(":P_para", OracleDbType.Int64)).Value = Convert.ToInt64(Textbox.Text);
cmd.Parameters.Add("p_cr2", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Output);