title: Handling null values in OracleCommand parameters
body: <p>I'm trying to determine how to specify null as a parameter value in an OracleCommand using the following C# code.  I've excerpted the relevant bits, but basically the point is if sal_id comes in with the value 0 it should be stored as null.  I've tried Null, "Null", and a couple other things but so far no luck.</p>
  
  <pre><code>cmd.CommandText = "INSERT INTO tcustomer(cust_id, salutation_id) VALUES(ORADBA.SEQCUST.NEXTVAL, :salid) RETURNING cust_id INTO :newcid" ;
  
  if (sal_id==0) {
    cmd.Parameters.Add("salid", Null) ;
  } else {
    cmd.Parameters.Add("salid", sal_id) ;
  }
  
  cmd.Parameters.Add("newcid", OracleDbType.Int32).Direction = ParameterDirection.ReturnValue ;
  
  cmd.ExecuteNonQuery() ;
  
  String newcidval = cmd.Parameters["newcid"].Value.ToString() ;
  cmd.Dispose() ;
  </code></pre>