Oracle 11g – XML Parsing Failed in SQLPlus

oracleoracle-11gsqlplusxml

I get following error when executing the query

Invalid token in '[count(../[name(../)=name(.)])=count(../) and count(../*)>1'

However when installing the Itstar_xml_util package, it asks for two initial variables one quot and another call gt, which form the initial structure of the XML, I believe that is causing the error, someone knows how to configure correctly?

SQL> @C:\instantclient_11_2\itstar_xml_util.pxk
     Packge created.
     Enter value for quot: ?
     Enter value for gt: ?

Also follow the query…

SQL > declare
      l_sql_string varchar2(32000);
      l_xml xmltype;
      l_json xmltype;
      begin
      l_sql_string := 'select DESCRICAO from VEI_TIPO_VEICULO';
      l_xml := 'itstar_xml_util.sql2xml(l_sql_string);
      dbms_output.put_line(l_xml.getclobval());
      l_json := itstar_xml_util.xml2json(l_xml);
      dbms_output.put_line(l_json.getclobval());
      end;
      /

Best Answer

You have to call

SET DEFINE OFF

before installing the package to ensure that &quot and &gt are not recognized as substitution variables. See also docs.