0

I'm using Oracle.ManagedDataAccess 19.6.0 to get some data from Oracle 11g 11.2.0.3.0

This code was working fine until yesterday. 223 rows are getting returned by Oracle. But the while (orclDataReader.Read()) is being skipped, as if there are no rows.

What am I doing wrong? Especially given that this same code has been running fine for at least a week now.

using (OracleDataReader orclDataReader = orclCommand.ExecuteReader())
{
    _logger.DebugFormat("{0} rows retreived ", orclDataReader.RowSize);
    while (orclDataReader.Read())
    {
        //do something with rows
        //this whole section is being skipped by VS debugger
    }
}
6
  • are you sure the command doesn't issue two selects? one with zero rows, and then your data? Commented Jan 22, 2020 at 19:16
  • @MarcGravell yes I'm sure that there is only one select in the SQL. The OracleConnection object is shared for multiple queries executed 1 by 1. There are no threads or processes involved. Commented Jan 22, 2020 at 19:22
  • @theb frankly then, it sounds like maybe the parameters are wrong, such that it is returning zero rows... Can you show any of the command code? Commented Jan 23, 2020 at 9:06
  • 1
    There is no magic. Take the SQL you use in command, and paste in Sql Developer. Run it and see if there are any rows. or modify select part in debug mode. Do select count(*) while leaving everything else same. Take command object and copy out of it ConnectionString property, see where you actually connecting. Questions like this always end up being problems like "connected to wrong DB/server". The code you posted does not do anything to point to a problem Commented Jan 23, 2020 at 17:38
  • 1
    @T.S. that's what it was. OracleDataReader.RowSize does not give row count! It gives " amount of memory (in bytes) that an OracleDataReader needs to store one row of data for the executed query". Row count probably does not exist in this library. Anyway - bottom line - row count was zero due to logic in the SQL. Commented Jan 23, 2020 at 19:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.