简体   繁体   中英

ORA-00911: invalid character?

I'm getting the following error:

ORA-00911: invalid character at XDocument doc= Document.Load(crtCommand.ExecuteScalar().ToString());*

With this code:

 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");
     }
 }

Get rid of the trailing semicolon.

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

Oracle doesn't like statement delimiters when passing in a single statement for immediate execution.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM