Calling Count() on IQueryable results in ORA-00933

Posts   
 
    
oskarf
User
Posts: 19
Joined: 05-May-2023
# Posted on: 22-Jan-2024 16:39:16   

Oracle 11g using ODA.NET. App is in .Net 7. After upgrading to 5.10.2 this code now throws and exception. I've tried to upgrade to 5.11.0 and hotfix 5.11.1 with the same result.

The code

LinqMetaData mData = new LinqMetaData(AdapterProvider.Current.Adapter);
IQueryable<GaChildobsPartMeasurementEntity> part =
   (from p in mData.GaChildobsPartMeasurement
    where p.PartId == criteria.PartId
    select p);
if (part.Count() == 1)

part.Count() throws an ORA-00933 exception.

This code worked in previous versions of LLBLGen (ie. 5.8.8 and earlier)

The SQL generated (as shown in the exception) seems to be: SELECT COUNT(*) AS LPAV_ FROM SAGA.GA_CHILDOBS_PART_MEASUREMENT LPLA_1 WHERE LPLA_1.PART_ID = '1AEF' FETCH NEXT 1 ROWS ONLY; if I drop the FETCH NEXT part when running this SQL it runs fine in an SQL editor against the database.

Part of the StackTrace

SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException
  HResult=0x80131500
  Message=An exception was caught during the execution of a retrieval query: ORA-00933: SQL command not properly ended. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.
  Source=SD.LLBLGen.Pro.ORMSupportClasses
  StackTrace:
   at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchDataReader(IRetrievalQuery queryToExecute, CommandBehavior readerBehavior)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchProjection(List`1 valueProjectors, IGeneralDataProjector projector, IRetrievalQuery queryToExecute, Boolean performValueProjectionsOnRawRow, Boolean postProcessDBNullValues, Dictionary`2 typeConvertersToRun)

Any ideas as to what the issue could be?

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 22-Jan-2024 18:06:31   

You need to set the Oracle DQE compatability mode

oskarf
User
Posts: 19
Joined: 05-May-2023
# Posted on: 22-Jan-2024 18:38:51   

That worked. Thanks