Hi All, I am currently working on Microsoft OracleClient to ODP.NET migration. I am basically done with code migration now. But I am having a problem here. When I am calling a stored procedure from C#, one parameter is not set to default value as it should be if I do not pass any value in.
command.CommandText = "csharp_stock_control_lib.OpenTradeSearch";
if (key["ApprovalState"] != null)
command.Parameters["p_state"].Value = key["ApprovalState"];
IDataReader reader = command.ExecuteReader();
p_state IN VARCHAR2 DEFAULT 'APP'…)
In another word, if key["ApprovalState"] is a null value here, "p_state" is not set to 'APP' which is the default value, instead it remains NULL.
I have tried to set BindByName = true which does not work.
Edited by: 967033 on 14-Nov-2012 21:12
NULL is a valid value for a varchar2, how is it supposed to tell when you mean to set it as NULL vs when you want the default?
Set BindByName = True and don't set the parameter p_state at all. That should cause it to use the default. Note that this requires BindByName, it won't work otherwise.