From C#, How to pass a clob value to oracle stored procedure
<p>My Oracle stored procedure is accepting a clob type parameter.</p>

<pre><code>procedure  p_insert_data(xml_string in clob)
</code></pre>

<p>From C#, I am trying to call the procedure by passing clob data, which is an XML file. </p>

<p>Following is the way which I tried: </p>

<p>Converting XML to string</p>

<pre><code> XmlDocument xmlDoc = new XmlDocument();
 xmlDoc.Load(@"D:\Response_min.xml");

 string xml = xmlDoc.OuterXml;
</code></pre>

<p>Passing clob data to stored procedure from C#</p>

<pre><code>OracleParameter p_data = new OracleParameter("p_xml_string", OracleDbType.Clob);
p_data.Direction = ParameterDirection.Input;
p_data.Value = xml; //xml is of string type 
dbCommand.Parameters.Add(p_data);
dbCommand.ExecuteNonQuery();
</code></pre>

<p>I am getting exception </p>

<blockquote>
  <p>operation not valid due to current state of object</p>
</blockquote>

<p>Instead of xml string, I tried passing <code>bytes[]</code> to clob parameter but still no luck.</p>

<p>I also tried to use XML which has less content. <br/>
Anyone has any clue about how I should pass clob value ?</p>