Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

No Results - Query with 'where not exists' and 2 Parameters

676100Dec 17 2008 — edited Dec 18 2008
Hallo

i have a query with two parameters. I get not result when I execute the query.

I do tests:
- Query works well in Oracle SQL Developer (with parameters)
- Same query works with System.Data.OracleClient
- Same query works with one of the parameters
- Another query with 2 parameters works correct (which does not contain the 'where not exists')

here is the statement:
OracleCommand command = new OracleCommand(
"select count(*) as anzahl_ds from bi_zas_zuordnung t1 where not exists (select cover_e_mandant, cover_obj_nr, cover_ausg, cover_jahr, cover_hnr from bi_zas_zuordnung t2 where t1.cover_e_mandant = t2.cover_e_mandant and t1.cover_obj_nr = t2.cover_obj_nr and t1.cover_ausg = t2.cover_ausg and t1.cover_hnr = t2.cover_hnr and t2.cover_jahr = :JAHR_NACH) and t1.cover_jahr = :JAHR_VON",connection);

command.Parameters.Add(new OracleParameter(":JAHR_VON", OracleDbType.Int32));
command.Parameters.Add(new OracleParameter(":JAHR_NACH", OracleDbType.Int32));
command.Parameters[0].Value = 2008;
command.Parameters[1].Value = 2043;

OracleDataReader dataReader = command.ExecuteReader();
while (dataReader.Read())
{
this.textBox1.Text = dataReader[0].ToString();
}

Any ideas where the error could be (I think it is the problem of the ODP.NET)

Regards
Gernot
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2009
Added on Dec 17 2008
2 comments
1,252 views