1 Reply Latest reply on Nov 15, 2012 12:26 PM by Tridus

    Default value of Oracle SP parameters not working with ODP.NET

      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.

      C# code:
      command.CommandText = "csharp_stock_control_lib.OpenTradeSearch";

      if (key["ApprovalState"] != null)
      command.Parameters["p_state"].Value = key["ApprovalState"];
      IDataReader reader = command.ExecuteReader();

      PROCEDURE OpenTradeSearch(…
      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