My Oracle stored procedure is accepting a clob type parameter.
procedure p_insert_data(xml_string in clob)
From C#, I am trying to call the procedure by passing clob data, which is an XML file.
Following is the way which I tried:
Converting XML to string
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(@"D:\Response_min.xml");
string xml = xmlDoc.OuterXml;
Passing clob data to stored procedure from C#
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();
I am getting exception
operation not valid due to current state of object
Instead of xml string, I tried passing bytes[]
to clob parameter but still no luck.
I also tried to use XML which has less content.
Anyone has any clue about how I should pass clob value ?