InvalidOperationException when using IQ driver with Oracle Connection

I'm not sure what the root cause for the issue may be. I have a table in Oracle that I'm trying to query using LINQPad with the IQ driver.

When I run a simple take command (Ah.Take(100)), it throws an error:
InvalidOperationException: The binary operator Equal is not defined for the types 'System.Int64' and 'System.Decimal'.

I went through all the columns that were Int64 and Decimal in the table and was able to select them individually.

I tried troubleshooting to narrow down the issue and so I scripted out a select new { all columns}, thinking that this would fail and I would comment out columns until I found the problem. The query runs without issue, however.

I'm not sure what causes the query to fail when requesting the record, but succeed when requesting a new object with every column on that record.

Is this a bug, or am I not using this the right way? Details are below:

LINQPad 5 (Free Edition) v5.31.00(AnyCPU)
IQ (Supports Oracle, MySQL, SQLite) v 2.1.4.0


The connection mode is OCI. I can connect using SQLTools (an oracle client) without issue.

Comments

  • Does the table that you're selecting have any associations? (Look for hyperlinks in the schema explorer). If so, how are the tables related? Is it possible that the primary key of one table is an Int64, and the foreign key of the other table is a decimal?
  • Thanks Joe, you are spot on with that. I just started using LINQPad and didn't think about the additional associations it would try to make to other tables.

    Unfortunately, whoever designed the database didn't think about ensuring the foreign keys' datatypes matched their primary keys. In this case, it is a decimal (number(38,0)) vs. an integer (number(22,0)).

    Is there any way to get this to work through LINQPad? Maybe turn off the associations or use a custom comparer? If not, it's all good, I'll just have to alias and bring back only the columns I want.
  • edited July 30
    I am having the same problem. Is there some workaround available?
    Maybe it is possible to define a custom comparer in "My Extensions" or something like that? I tried it, but wasn't successful so far...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!