This content has been marked as final. Show 3 replies
782959 wrote:I'm in agreement with Dennis. You are passing a character string for the date using an unknown (at least to us) format. If the default format values (i.e. NLS_DATE_FORMAT) differ between client, server, and the actual value passed I would not be surprised to see "incorrect" results.
I'm trying to loop through a cursor. When I execute the command (denoted as sql - see below) directly in pl/sql I'm getting result set with more rows. But when I run this code, I'm getting only one row:
using (OracleConnection conn = new OracleConnection(connstring))
string sql = "select close, ts from dpr@price where qot_id=2029543939 and ts>='" + start + "' and ts<='" + end + "'";
using (OracleCommand comm = new OracleCommand(sql, conn))
using (OracleDataReader rdr = comm.ExecuteReader())
The code doesn't throw any exception(at least not in an usual way; I mean it doesn't stop or writes stack trace). However I can see these lines by reader Object while debugging(I don't really think it is relevant here, but showing the output "just in case"):
InitialLONGFetchSize = 'rdr.InitialLONGFetchSize' threw an exception of type 'System.NullReferenceException'
InitialLOBFetchSize = 'rdr.InitialLOBFetchSize' threw an exception of type 'System.NullReferenceException'
The results should have only types DateTime and Number (10,4). And the table has no fields with type lob or long.
This is the table scheme:
The query is correct and the entries exist. The returned row seems to be random one... It is not the first or last row. I'm using ODT with ODAC 11. I have VS2012 and working under windows 7(32-bit). I'm connected to Oracle 10g .
Any clue what am I doing wrong?
Also, you are just gluing in values which opens up the possibility for SQL Injection. Any reason for not using parameters?