This discussion is archived
3 Replies Latest reply: Apr 19, 2013 4:38 PM by Alex_Keh - Oracle_Product_Manager RSS

Bug: Oracle Managed Provider and BindByName

Invincible Newbie
Currently Being Moderated
I have following where statement:
and (:p0 is null or V.IS_CLOSED =:p0)
and (:p2 is null or V.USER_ID = :p2)
AND (:p4 IS NULL OR v.OUTLET_NUMBER =:p4)
and (:p6 is null or O.DELIVERY_LOCATION_CODE = :p6)
and (:p8 is null or :p8 <= v.PLANNED_DATE)
AND (:p10 IS NULL OR :p10 > v.PLANNED_DATE)
and
com.BindByName = true;
com.Parameters.Add("p0", OracleDbType.Decimal, 0, System.Data.ParameterDirection.Input);
com.Parameters.Add("p2", DBNull.Value);
com.Parameters.Add("p4", DBNull.Value);
com.Parameters.Add("p6", DBNull.Value);
com.Parameters.Add("p8", DBNull.Value);
com.Parameters.Add("p10", DBNull.Value);
This code is working in UnManaged client, but now I getting ORA-01008: not all variables bound
If I do something like this:
com.BindByName = true;
com.Parameters.Add("p0", OracleDbType.Decimal, 0, System.Data.ParameterDirection.Input);
com.Parameters.Add("p0", OracleDbType.Decimal, 0, System.Data.ParameterDirection.Input);
com.Parameters.Add("p2", DBNull.Value);
com.Parameters.Add("p2", DBNull.Value);
com.Parameters.Add("p4", DBNull.Value);
com.Parameters.Add("p4", DBNull.Value);
com.Parameters.Add("p6", DBNull.Value);
com.Parameters.Add("p6", DBNull.Value);
com.Parameters.Add("p8", DBNull.Value);
com.Parameters.Add("p8", DBNull.Value);
com.Parameters.Add("p10", DBNull.Value);
com.Parameters.Add("p10", DBNull.Value);
It's working.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points