I am trying to use bind variables in C# to get records in select query. The below code is what I've tried but I get exception as: ORA-01006: bind variable does not exist . I'm not getting where is the variable being not present or something else ?
string sleeveListQuery = @"select col from table where id = :V1 :V2 ";
inClause="some condition";
List<SleeveSearch> sleeveSearchList= new List<SleeveSearch>();
using (OracleConnection objConn = new OracleConnection(ConnectionString))
{
objConn.Open();
using (var command = objConn.CreateCommand())
{
command.CommandText = sleeveListQuery;
command.Parameters.Add(":V1", OracleDbType.Int32, Int32.Parse(univId), ParameterDirection.Input);
command.Parameters.Add(":V2", OracleDbType.Varchar2, inClause, ParameterDirection.Input);
OracleDataReader dr = command.ExecuteReader();
while (dr.Read())
{
SleeveSearch dataRow = new SleeveSearch();
dataRow.SleeveName = dr["SLEEVENAME"].ToString();
sleeveSearchList.Add(dataRow);
}
}
}