如何使用 ExecuteXmlReader 和 ExecuteStream 查询 oracle

how to query oracle using ExecuteXmlReader and ExecuteStream

我想使用 c# 为 oracle 使用 ExecuteXmlReader 和 ExecuteStream 方法。 我尝试了各种查询,但没有一个有效。 我需要的是 oracle 中的 xml 查询。

例如,对于 microsoft sql,我将字符串转换为 xml 为:

DECLARE @string VARCHAR(100);
DECLARE @xml XML;
SET @string ='<bookstore><book>Candide</book<>/bookstore>';SET @xml = CAST(@string AS XML);
SELECT @xml;

我需要类似于 oracle 的东西。 我试过:

select * from XMLType('<bookstore><book>Candide</book<>/bookstore>')

失败了。 我知道目的不明确。我正在尝试 测试 这两种方法,但我的数据库没有任何以 xml 格式存储的数据。

你可以这样做:

select xmltype('<bookstore><book>Candide</book></bookstore>') from dual;

检查我是否更改了您的字符串,因为它有令牌错误。