ORA-01427 Exception not being thrown
Posted: Fri 08 Jul 2016 19:40
I have a .NET application which runs a query against an Oracle view. The View has a subquery in the select statement and on occasion that subquery returns multiple rows. My issue is that the ORA-01427 Exception isn't being thrown by the Devart OracleDataReader. Instead the application hangs until the Command Timeout is reached at which time I get an "ORA-03113: end-of-file on communication channel". I would expect instead the actual error message "ORA-01427: single-row subquery returns more than one row".
I have noticed that if I change the FetchSize on the command object to 1 then I do indeed get the error, but I should be able to set the FetchSize to 200 and still get the ORA-01427 error.
If I use the Oracle Data Provider for .NET from oracle it does throw the ORA-01427 error.
I have noticed that if I change the FetchSize on the command object to 1 then I do indeed get the error, but I should be able to set the FetchSize to 200 and still get the ORA-01427 error.
If I use the Oracle Data Provider for .NET from oracle it does throw the ORA-01427 error.
Code: Select all
OracleConnection con = null;
OracleCommand cmd = null;
OracleDataReader rdr = null;
int counter = 0;
try
{
con = new OracleConnection(connectionString);
con.Open();
cmd = new OracleCommand(query, con);
cmd.CommandTimeout = 20;
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
Console.WriteLine(++counter);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}