I'm trying to create a XML in stored procedure in this way:
PROCEDURE DeviceSearched(
xml_out OUT XMLTYPE
)
IS
BEGIN
SELECT
XMLELEMENT("Values",
XMLFOREST(de_brand)
)
INTO xml_out
FROM
tbldevice de
;
END DeviceSearched;
And I trying to read xml_out
in c# in this way:
...
OracleCommand command = new OracleCommand(name, conn);
command.CommandType = CommandType.StoredProcedure;
command.BindByName = true;
...
command.Parameters.Add(new OracleParameter("xml_out", OracleDbType.XmlType, ParameterDirection.Output));
With this approach the issues are two:
What am I doing wrong?
Thanks in advance
Running
SELECT XMLELEMENT("Values",XMLFOREST(de_brand)) FROM tbldevice de
In plsql will NOT result a single value, So trying to fetch the result in to single variable ( INTO xml_out
) will result run time error ORA-01422
Using a store procedure to select data in Oracle is not apperciated, its a SQL Server approch, why not using a simple select
Examples here and here will show how ODP.Net works with XML
You may need to mix using ref corsur and XMLType to solve the matter
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.