1 Reply Latest reply: Nov 15, 2012 6:26 AM by Tridus RSS

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

    970036
      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();

      SP:
      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