简体   繁体   中英

Entity Framework cannot concat Enum column in Oracle

Im using EntityFramework 6.1 with Oracle, I need to write the query to concatenate two columns in where predict expression.

I used the below code:

/* t.Col1 : string , t.Col2: Enum */
db.Table1.Where(t => t.Col1 + " " + t.Col2 == "SomeValue");

But I get the OracleException: ORA-12704: character set mismatch error. I want to apply the condition before fetch the data from Database. So anyone has idea how can I handle this issue?

I already saw this topic , but that solution doesn't work if one of the column be Enum.

I've checked the commandtext and found try to convert empty char to NCLOB

THEN N'' ELSE TO_NCLOB

So I updated the @solidau answer with following solution:

command.CommandText = command.CommandText.Replace("N''", "''").Replace("THEN '' ELSE TO_NCLOB", "THEN N'' ELSE TO_NCHAR");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM