Typecast null to char and number in same column

Typecast null to char and number in same column

Postby Werlang » Wed 19 Jun 2013 20:19

We have the following query:
Code: Select all
var list = _query.Search(x => x.DataSource.Equals(param1) && (x.User.Login.Equals(login) || x.User == null));

var result =
    (from item in list
     select new
     {
         item,
         filters = item.Filters,
         data    = from a in item.Data
                   where a.User.Login == login
                   select new { data, data.Values },
         filters2 = from b in item.Filters2
                    select new { b, b.Values },
         default = item.Default,
         columns = from c in item.Columns
                   where c.Show
                   orderby c.Order
                   select c
     }).AsEnumerable();

result.First();


On SQL Server it runs OK, but on Oracle it produces a query which mixes char and number columns.

To simplify, it generates something like:
Code: Select all
select to_char(null) as a
from tab1
union select to_number(null)
from tab2


As seen, there's a typecast to char and to number in the same column.

I'd like to know what can lead to such a SQL.

Thanks in advance. Please let me know if you need further information.
Werlang
 
Posts: 4
Joined: Wed 19 Jun 2013 20:04

Re: Typecast null to char and number in same column

Postby Shalex » Fri 21 Jun 2013 16:18

Please specify the ORM framework you are using (e.g.: Entity Framework) and send us a small test project with the model.
Shalex
Devart Team
 
Posts: 7530
Joined: Thu 14 Aug 2008 12:44

Re: Typecast null to char and number in same column

Postby Werlang » Fri 21 Jun 2013 21:43

Hello

It'd take some time but we'll produce this sample.
Werlang
 
Posts: 4
Joined: Wed 19 Jun 2013 20:04


Return to dotConnect for Oracle