7 Replies Latest reply on May 23, 2017 5:49 PM by Vadim Tropashko-Oracle

    code outline fails when xmltable is used

    1616425

      In Oracle sql developer Version 4.2.0.17.089:

       

      Having a correct compiled package, procedure, function or even a working sql-statement, code outline gives you the following message:

       

      "Syntax error; Partial parse tree;"

       

      It seems that the parser doesn't recognise the full XMLTABLE syntax !

       

      As result you get an incomplete out-line.

        • 1. Re: code outline fails when xmltable is used
          thatJeffSmith-Oracle

          please share a code sample

          • 3. Re: code outline fails when xmltable is used
            1616425

            declare
               TYPE rec_wabc IS RECORD (
                     wabc    number
                   );

              v_rec rec_wabc;
             
              function xml2rowtype_wabc(p_xml xmltype)
                 return rec_wabc
              is
                rt_wabc  rec_wabc := null;
              begin

                select x.v00 wabc
                into rt_wabc
                from xmltable(
                     '/*[1]'
                     passing p_xml
                     columns
                         v00 path 'Wabc'       -- without namespace
                        ) x;
                --
                return rt_wabc;
                --
              end xml2rowtype_wabc;
            begin
              -- just some code
              v_rec:=xml2rowtype_wabc(p_xml=>xmltype('<a><Wabc>123</Wabc></a>'));
              dbms_output.put_line('The result is: '||v_rec.wabc);
                    -- it gives output / it compiles but gives
                    -- in the code outline: Syntax error; Partial parse tree
            end;
            /

            • 4. Re: code outline fails when xmltable is used
              Vadim Tropashko-Oracle

                  select *

                  from xmltable(

                       '/*[1]'

                       passing p_xml

                       columns

                           v00 path 'Wabc'      

                          ) x;

               

              still fails to parse. This  bug  traces to documentation railroad syntax:  According to XMLTABLE syntax specification there is required datatype in the XML_table_column

              • 5. Re: code outline fails when xmltable is used
                1616425

                SQL> select *
                  2      from xmltable(
                  3           '/*[1]'
                  4           passing xmltype('<a><Wabc>123</Wabc></a>')
                  5           columns
                  6               v00 path 'Wabc'
                  7              ) x;

                V00
                --------------------------------------------------------------------------------
                123

                 

                this code will parse.You forgot to substitute p_xml.  Indeed: the syntax specification there is required datatype in the XML_table_column. But Oracle still work without the specification. And Indeed when we insert the datatype behind v00:  the Eror message: "Syntax error; Partial parse tree;" will disappear!

                • 6. Re: code outline fails when xmltable is used
                  Gary Graham-Oracle

                  Indeed: the syntax specification there is required datatype in the XML_table_column. But Oracle still work without the specification.

                  The SQL Developer parser's algorithms are just driven by metadata which (we think/hope) accurately represents the documented syntax rules, so...

                  1. If the Oracle parser behavior is correct, then we have a documentation bug which, in turn, has misled Vadim.

                  2. If the documentation is correct, then we have an Oracle bug instead.

                   

                  I would guess current SQL Developer behavior will not change unless the documented syntax changes. You are always free to log a service request with My Oracle Support.

                  Edit:

                  Sorry, It seems I missed the point.  Even if the user syntax is in error (for example, in Vadim's code sample: SQL Error: ORA-00904: "P_XML": invalid identifier),

                  it is undesirable to have the Code Outline get the "Syntax error; Partial parse tree;" and not render the full outline.

                  • 7. Re: code outline fails when xmltable is used
                    Vadim Tropashko-Oracle

                    Bugged and fixed for 17.2