oracle向in语句传入参数查不出数据

在oracle字符串中使用了in,但是查不出数据

1 string getModel = "select * from TB_YBSH where ID in :ids";
2 OracleParameter p = new OracleParameter("ids", ids);
3 DataTable dt = DbHelperOra.ExecuteTable(getModel,p);

直接拼接就可以

 string getModel = "select * from TB_YBSH where ID in"+ids;

但是还是想要使用参数查询,在网上查了下,发现了instr的用法,于是写成这样,问题解决

string getModel = "select * from TB_YBSH where instr(:ids,ID)>0";
OracleParameter p = new OracleParameter("ids", ids);
DataTable dt = DbHelperOra.ExecuteTable(getModel,p);

参考http://overloving.iteye.com/blog/1638769

原文地址:https://www.cnblogs.com/castdream/p/4720121.html