question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Column ambiguously defined ORA-00918

See original GitHub issue

The code below results in ‘Column ambiguously defined ORA-00918’ This occurs if version of Oracle.EntityFrameworkCore is 3.19.80 Worked well in Oracle.EntityFrameworkCore 2.19.90

`class Order{ public int Id{get;set;} public DateTime? CompletionDate{get;set;} public bool IsActive{ var now = DateTime.Now return now<this.CompletionDate || CompletionDate==null; } }

class OrderDetail{ public int Id{get;set;} public int OrderId{get;set;} public Order Order{get;set;} }

(from od in db.OrderDetails.Include(d=>d.Order) select new {Id=od.Id, IsActive=od.Order.IsActive}).ToArray()`

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
omon77commented, Nov 20, 2020

@danko007 You can avoid this bug, by configuring your db context to use SQL compatible with Oracle 11g, that doesn’t have this bug: services.AddDbContext<yourDbContext>(options => options.UseOracle(yourDbConnectionString, b => b.UseOracleSQLCompatibility("11"))

0reactions
kvansaderscommented, Mar 8, 2021

@danko007 You can avoid this bug, by configuring your db context to use SQL compatible with Oracle 11g, that doesn’t have this bug: services.AddDbContext<yourDbContext>(options => options.UseOracle(yourDbConnectionString, b => b.UseOracleSQLCompatibility("11"))

This worked for me. Thanks!

<PackageReference Include="Oracle.EntityFrameworkCore" Version="3.19.80" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.12" />
Oracle 12c EE

Interesting that it worked for you. I’m still getting the same error with Oracle 12.1.0.2 Running application is net5.0, within startup:

            services.AddDbContext<DNADbContext>(options =>
                options.UseOracle(
                    Configuration.GetConnectionString("DbContext"), b => b.UseOracleSQLCompatibility("11")
                ));

DBContext is within another library, netstandard2.1

<PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Oracle.EntityFrameworkCore" Version="5.21.1" />
  </ItemGroup>

I tried using the EF package versions you specified, still with no resolution. When I repoint to a local 18XE though, it does work just fine.

Also - Is there something that would possibly need to be configured on the 12.1 server for b.UseOracleSQLCompatibility(“11”) to actually work?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ORA-00918: column ambiguously defined tips
ORA-00918 column ambiguously defined. Cause: A column name used in a join exists in more than one table and is thus referenced ambiguously....
Read more >
ORA-00918: column ambiguously defined
The source of an ORA-00918 error comes from a mistake when attempting to join two or more tables that share the same name...
Read more >
ORA-00918: column ambiguously defined in SELECT
The solution is quite simple: you will have to expand the projection to explicitly select named columns. Then you can either leave out...
Read more >
Oracle / PLSQL: ORA-00918 Error Message
Cause. You tried to execute a SQL statement that joined two or more tables, where a column with the same name exists in...
Read more >
ERROR: "ORA-00918: column ambiguously defined" is seen ...
This issue is caused by a duplication in the table definitions when 'Support mixed-case identifiers' is selected in the connection properties of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found