I have followed all questions here and both .Net & Oracle documentation, and found no hope but to get help here!
I have a procedure that returns a SYS_REFCURSOR
I managed to retreive it as outparam, but having a hard time figuring out what's the problem with filling the DataTable
from the cursor
OracleCommand cmd = new OracleCommand();
cmd.CommandType = CommandType.StoredProcedure;
...
cmd.Parameters.Add("pView", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
OracleRefCursor cursor = (OracleRefCursor)cmd.Parameters["pView"].Value;
// cursor.RowSize = 2540
OracleDataAdapter da = new OracleDataAdapter(cmd);
DataTable dt = new DataTable();
int rowsCount = da.Fill(dt, cursor);
// rowsCount = 0
Well, after a really big hasstle, it seemed that the RowSize
& FetchSize
are irreliable!
The problem was with the parameters arriving incorrectly to the database (order of parameters!)
But thanks to this comment it's solvable by setting cmd.BindByName = true;