Linq outer join with oracle 8i

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
crein
Posts: 2
Joined: Wed 01 Sep 2010 09:22

Linq outer join with oracle 8i

Post by crein » Wed 01 Sep 2010 09:59

Hi all :)

Im trying to perform an outer join on a old oracle server version 8.1.6.

I know that Oracle 8i doesnt support ansi join an therefore im using the following syntax to do an inner join.

LINQ:
from table1 from table2
where table1.table2Id.Equals(table2.Id)
select new { .... an so on.

This works.
But if i want to do an "outer join" in Linq i would at something like:

from table1 from table2.DefaultIfEmpty()

But then i get this: "ORA-00933: SQL command not properly ended"
This is the same error i get when i use the ansi join syntax.

I know that oracle uses an sql syntax for outer joins with (+) like:

Code: Select all

select 
  table1.Id, table2.table1Id
from 
  table1, table2
where 
  table1.Id = table2.table1Id (+)
Is there any way to do a old stylish outer join in LINQ that will work with an old oracle database?

crein
Posts: 2
Joined: Wed 01 Sep 2010 09:22

Post by crein » Wed 01 Sep 2010 11:08

This is my current LINQ:


Code: Select all

var lagerKart = 
                     (from l in xalDb.Lagerkarts
                     from r in xalDb.Prisrabats
                     from s in xalDb.Lagersums
                     where 
                     l.Dataset.Equals("DAA") && l.Varenummer.Equals(abProductId) && r.Dataset.Equals("DAA") && r.Varerelation.Equals(l.Linierabat) && r.Varekode.Equals("1") && r.Kontokode.Equals("1") && r.Kontorelation.Equals("3") && s.Dataset.Equals("DAA") && s.Varenummer.Equals(abProductId)
                     select new { Varenummer = l.Varenummer, Linierabat = l.Linierabat, l.Salgspris, Procent1 = r.Procent1, Procent2 = r.Procent2, Procent3 = r.Procent3, s.Bogfxrtantal, s.Modtaget, s.Reservfysisk, s.Reservbestilt, s.Trukket }).SingleOrDefault();
                
This i doing the inner join. An this works perfect when all 3 tables return values. But this is not the case every time :)

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 02 Sep 2010 15:33

Thank you for your suggestion, we will analyze the possibility of supporting the outer join syntax for older versions of Oracle servers. We will report here about the results.

Post Reply