Oracle SQL语句对Linq无效 [英] Oracle SQL statement to Linq Not working
本文介绍了Oracle SQL语句对Linq无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个查询,需要将其转换为SQL.一直在寻找这样做的一段时间,但没有成功 这是ORACLE查询
I have a query that I need to have it converted in SQL. Been searching on doing this for some time now but nothing is successful here is the ORACLE query
SELECT
DRKY AS REASON_CODE,
DRDL01 AS DESCRIPTION
FROM shema.SourceTable
WHERE drsy = '00' AND DRDL01 IS NOT NULL AND (drrt = 'W4' OR drrt = 'W5') and NVL ( trim(DRKY), '000') = '801';
这是我的Linq查询,不返回值
This is my Linq query that does not return value
var RJDEReasonCode = from a in JTable.SourceTable
where
a.DRSY.Equals( "00") &&
a.DRDL01 != null &&
(a.DRRT.Equals( "W4") ||
a.DRRT.Equals( "W5")) &&
a.DRKY.Equals( "801") // here is where the problem is tried many things but nothing has worked so far.
select new
{
CATEGORY_CODE = a.DRRT,
REASON_CODE = a.DRKY,
DESCRIPTION = a.DRDL01
};
推荐答案
看起来您只需要修剪DRKY
:
a.DRKY.Trim() == "801"
或者可能:
a.DRKY != null && a.DRKY.Trim() == "801"
(我个人发现==
用于字符串比较比使用Equals
更简单,但是使用YMMV.)
(Personally I find ==
for string comparisons to be simpler than using Equals
, but YMMV.)
这篇关于Oracle SQL语句对Linq无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文