The riddle of the working broken query The riddle of the working broken query oracle oracle

The riddle of the working broken query


Hmmm...A few things to check:

  1. Does this code actually run? It may seem silly to suggest this, but there may be a newer file that replaced this one.

  2. Is an exception being squelched by your code? (Anyone who would name columns like that is definitely capable of squelching those pesky exceptions)

  3. Is the exception being squelched by 3rd party code? (Not as likely, but sometimes 3rd party code prefers to use annoying error codes instead of exceptions).

Past those suggestions, I'm not sure.

EDIT:

Revisiting the 2nd point, if you are working in ASP.NET, check that there is no global-level exception handler that is squelching exceptions. I ran into that problem on one site that I worked on and found dozens of exceptions in a single day.


Try running

select * from v$sql where sql_fulltext like '%a.RRRAREQ_TRST_DESC%'

shortly after you bind the grid. That will tell you if the statement was actually seen by Oracle. Note that you should only see the above query if it was not seen by Oracle.


Use ODBC trace log to see if this query is really send to database, and see what database returns. Then use any other ODBC based database tool and check if this query work from this tool. As an ultimate test you can write simple Python script. Easiest way it to use ActiveState Python 2.x with odbc module included. Test code can look like:

import odbcconnection = odbc.odbc('dnsname/user/password')cursor = connection.cursor()cursor.execute("select ...")for row in cursor.fetchall():    print '\t'.join([str(r) for r in row])

If there was no error in your program and an error in other tools then compare theirs ODBC traces.