我正在尝试将 XML 类型传递给 Oracle 9i 中的存储过程。它应该做的就是从节点中提取一个值并返回它,但它不是返回值。任何人都可以建议吗?
XMLString = "<?xml version='1.0' encoding='utf-8' ?>";
XMLString += "<Document>";
XMLString += "<DocumentType>WorkOrder</DocumentType>";
XMLString += "<DocumentAction>Create</DocumentAction>";
XMLString += "<WorkOrder>";
XMLString += "<WO>123456</WO>";
XMLString += "<WOTask>1</WOTask>";
XMLString += "</WorkOrder>";
XMLString += "</Document>";
oraCon.ConnectionString = s_connectionString;
oraCon.Open();
oraCommand.CommandType = CommandType.StoredProcedure;
oraCommand.CommandText = "LOUISETEST.GetActionType";
oraCommand.Connection = oraCon;
oraCommand.Parameters.Add("xml_document_i", OracleDbType.XmlType, XMLString, ParameterDirection.Input);
oraCommand.Parameters.Add("action_i", OracleDbType.Varchar2, result, ParameterDirection.Output);
oraCommand.ExecuteNonQuery();
Console.WriteLine("Result : "+result.ToString());
存储过程如下:
PROCEDURE GetActionType
(
xml_document_i IN XMLTYPE
,action_i OUT VARCHAR2
)
AS
BEGIN
SELECT xml_document_i.Extract('/DocumentAction/text()').getstringval() INTO action_i
FROM TABLE (XMLSEQUENCE (xml_document_i.EXTRACT ('/Document') ) ) ;
END GetActionType;