I am using
- Oracle 11g
- Devart 8.5.592
- EntityFramework 6.1.3
The following C# code:
var testResults = _clientRepository.AsQueryable()
.Select(c =>
"First" +
(!string.IsNullOrEmpty("Second") ? ", " : "") +
"Third")
.ToList();
Converts to the following SQL in Oracle:
SELECT 'First' ||
CASE WHEN
CASE WHEN NOT (('Second' IS NULL) OR (6 = 0))
THEN ', '
ELSE '' END IS NULL
THEN N'' WHEN NOT (('Second' IS NULL) OR (6 = 0))
THEN ', '
ELSE '' END || 'Third' AS C1
FROM CLI.CLE_GROUPS "Extent1"
Note: The C# code is deliberately pointless. It serves just to emphasise that it is the concatenation of strings with conditional strings that causes the problem.
This SQL when run causes the "ORA-12704: character set mismatch" exception... It is the N'' that is causing the problem. No part of the schema is using unicode.
Does anyone have any idea why it has decided to make this one empty string unicode, or even why the empty string and nested case statement are there in the first place?