ORA-00911:无效字符

本文关键字:字符 无效 ORA-00911 | 更新日期: 2023-09-27 18:26:52

我得到以下错误:

ORA-00911:XDocument doc=Document.Load(crtCommand.ExecuteScaler().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");
     }
 }

ORA-00911:无效字符

去掉后面的分号。

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

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