title: oracle how to pass null from .net
body: <p>I have a parameter in my oracle function that i want to pass null to it,</p>
  
  <p>what i did is:</p>
  
  <pre><code>cmd.Parameters.AddWithValue("al_acc_br", DBNull.Value);
  </code></pre>
  
  <p>however, i am getting error that <code>the number of parameters or the type is not correct</code> and as you know we can't see the actual query from .net library</p>
  
  <p>the number is absolutely correct, but in my way to debug the issue i would like to ask you if i am passing the null correctly </p>
  
  <p>thanks</p>
  
  <h3>Update </h3>
  
  <p>some code</p>
  
  <pre><code>using (OracleConnection cn = new OracleConnection(OracleConnString(oracleHost, oraclePort, oracleServiceName, oracleUsername, oraclePassword)))
              {
                  OracleDataAdapter oda = new OracleDataAdapter();
                  OracleCommand cmd = new OracleCommand();
                  cmd.Connection = cn;
                  cmd.CommandText = oracleSchema + "." + oracleFunction;
                  cmd.CommandType = CommandType.StoredProcedure;
                  fillParameters(cmd);
                  oda.SelectCommand = cmd;
  </code></pre>
  
  <p><strong>i know that i am using a deprecated library but it is fine for us</strong></p>
  
  <h3>Update 2</h3>
  
  <p>the parameter in my oracle function has these types:</p>
  
  <pre><code>Varchar(8), Varchar(40), Numeric(4), Numeric(6), Varchar(35), Numeric(3), Date, Numeric(20,6), Datetime
  </code></pre>
  
  <p>and what i do is:</p>
  
  <p>for all <code>varchar(x)</code> i insert them from c# as string
  for all <code>numeric(x)</code> i insert them from c# as integer
  for all <code>numeric(x,y)</code> i insert them from c# as double
  for all <code>Date</code> and <code>Datetime</code> i insert them like this:</p>
  
  <pre><code>cmd.Parameters.AddWithValue("as_date_time", DateTime.Now.ToString("dd/MMM/yyyy"));//'18/MAY/2015'
  </code></pre>
  
  <p>am i wrong please?</p>