如何向IN操作符传递参数?

8

我正在尝试为命名查询(本地SQL)传递一个长数组以在IN语句中使用:

(...) WHERE Identificator IN (:pIdes)

我试过将我的ides作为long[]传递:

 ctx.GetNamedQuery("NamedQueryName")                                          
                   .SetParameter<long[]>("pIdes", Identificators)
                   .List<EmpreendimentoInputReport>();

并且作为一个字符串

 ctx.GetNamedQuery("NamedQueryName")                                          
                   .SetParameter<string>("pIdes", Identificators)
                   .List<EmpreendimentoInputReport>();

当参数为字符串时不返回任何内容,当参数为long[]时返回以下 Oracle 错误:

"Oracle.DataAccess.Client.OracleException: ORA-00932: 数据类型不一致:期望 NUMBER 得到 BINARY"


https://dev59.com/VEzSa4cB1Zd3GeqPmGKV - Mauricio Scheffer
1个回答

14

请使用SetParameterList代替SetParameter


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接