Using the following code;
 
   try
    {
      db.begin();

      OQLQuery query = db.getOQLQuery( "SELECT c FROM "   + Customer.class.getName()   +   " c " +   "WHERE shortName = \" ABC \"" );
      QueryResults results = query.execute();
    ...etc
 
Customer is a simple bean with two fields; number and shortName.
 
Running this code throws the following Exception;
 
org.exolab.castor.jdo.PersistenceException: Nested error: com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near 'myview.'. while executing
SELECT "myview"."cust_number","myview"."short_name" FROM "myview" WHERE ("myview"."cust_short_name" = 'ABC' )
 
Anybody have any ideas?  The spacing is correct but the introduction of the double quotes worry me.  If I execute the formatted SQL query in a database interpreter I get the same 'incorrect syntax' problem.  If I ditch the quotes it works fine.
The only other unusual thing is that column 'number' is in fact a char(8) - I don't have control over the view that contains the customer data.  However, it looks like this is not the issue here.
 
Thanks,
Robert Pieper


NOTICE
This e-mail and any attachments are confidential and may contain copyright material of Macquarie Bank or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Bank does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Bank.

Reply via email to