Error While executing LINQ query using dotConnect with Oracle.

Error While executing LINQ query using dotConnect with Oracle.

Postby sudhanshu » Mon 28 Jul 2014 07:33

I am struggling with an error please help me ASAP,
Please find below details :-
While executing the the below mentioned query I am getting unnecessary error.
It is very simple query I can easily execute it in Oracle.
I am using Devart.Data.Oracle, Version=8.4.201.0

Exception : {"OUTER APPLY is not supported by Oracle Database 11g and lower. Oracle 12c or higher is required to run this LINQ statement correctly. If you need to run this statement with Oracle Database 11g or lower, rewrite it so that it can be converted to SQL, supported by the version of Oracle you use."}

My query : -

var cntx=new MyContext();
cntx.PROPERTies.Include(x=>x.PROPERTY_ADDRESS);
var prp = cntx.PROPERTies.Where(x => x.PROPERTY_STATUS == "A")
.Select(x => new
{
PropertyId = x.PROPERTY_ID,
PropertyAddress = x.PROPERTY_ADDRESS.FirstOrDefault(),
CreatedDate=x.CREATED_DATE
});
//Error occurred while executing below command.
var recordCount = prp.Count();
sudhanshu
 
Posts: 3
Joined: Thu 08 May 2014 10:46

Re: Error While executing LINQ query using dotConnect with Oracle.

Postby Shalex » Tue 29 Jul 2014 09:53

sudhanshu wrote:It is very simple query I can easily execute it in Oracle.

You can find out the SQL statement which fails to execute via the dbMonitor tool:
http://www.devart.com/dotconnect/oracle/docs/?dbmonitor.html
http://www.devart.com/dbmonitor/dbmon3.exe

sudhanshu wrote:Exception : {"OUTER APPLY is not supported by Oracle Database 11g and lower. [...]

This is a limitation of Entity Framework which does not take into account the peculiarities of other databases which differ from SQL Server: http://social.msdn.microsoft.com/Forums/en/adodotnetentityframework/thread/ae826dd9-1bab-4f64-a7ee-f082a2177346.

The OUTER APPLY/CROSS APPLY constructions are supported by Oracle server starting from the 12c version. Our implementation in dotConnect for Oracle avoids generation of OUTER APPLY/CROSS APPLY if it is possible, but some LINQ queries cannot be translated without employing OUTER APPLY/CROSS APPLY. In this case you should rewrite your LINQ statement. Scenarios which lead to CROSS APPLY/OUTER APPLY are listed at http://forums.devart.com/viewtopic.php?t=23362.
Shalex
Devart Team
 
Posts: 7782
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle