ORA-00911:字符无效?

时间:2013-08-08 01:29:07

标签: c# xml oracle

我收到以下错误:

  

ORA-00911:XDocument上的无效字符doc = Document.Load(crtCommand.ExecuteScalar()。ToString()); *

使用此代码:

 using (OracleConnection conn1 = new OracleConnection(oradb1))
 {
     conn1.Open();

     using (OracleCommand crtCommand
         = new OracleCommand("SELECT dbms_metadata.get_sxml('VIEW','VIEW_TBL_A') FROM dual;", conn1))
     {
         XDocument doc = XDocument.Load(crtCommand.ExecuteScalar().ToString());
         XNamespace ns = "http://xmlns.oracle.com/ku";

         if (doc.Descendants(ns + "COL_LIST_ITEM").Any(c => c.Attributes().Any()))
             MessageBox.Show("COL_LIST has value");
         else 
             MessageBox.Show("COL_LIST has no value");
     }
 }

1 个答案:

答案 0 :(得分:4)

摆脱拖尾分号。

using (OracleCommand crtCommand = new OracleCommand(
    "SELECT dbms_metadata.get_sxml('VIEW','VIEW_TBL_A') FROM dual", conn1))

Oracle在传递单个语句以立即执行时不喜欢语句分隔符。