1
我的Oracle存储过程正在接受clob类型参数。从C#中,如何将clob值传递给oracle存储过程
procedure p_insert_data(xml_string in clob)
从C#,我想通过传递clob数据,这是一个XML文件来调用过程。
以下是我试过的方式:
转换XML字符串
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(@"D:\Response_min.xml");
string xml = xmlDoc.OuterXml;
从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();
我得到异常
传递CLOB数据存储过程operation not val由于对象的当前状态造成的ID
取而代之的是xml字符串,我尝试传递bytes[]
来clob参数,但仍然没有运气。
我也尝试使用内容较少的XML。
任何人都有关于如何传递clob值的线索?
可能出现[使用大型CLOB从C#调用存储过程的问题](http://stackoverflow.com/questions/3557995/issues-calling-stored-procedure-from-c-sharp-with-large-clob) –
@NullException它与该CLOB大小问题无关,我也尝试使用较少内容的XML。 –
尝试'OracleParameter(“p_xml_string”,OracleDbType.XmlType);' –