Using Oracle SQL Developer (3.2.20.09),
PL/SQL will compile and run the below code correctly.
However, Oracle SQL Developer incorrectly parses the tokens.
-The connections pane will incorrectly scope the "temp" and "ord" variables in the package's and not the procedure's scope.
-The connections pane will not recognize the procedure "example."
-The code editor pane will not generate "scope expand and collapse" nodes.
If you were to comment line 19 and and uncomment line 21, the engine would correctly parse.
This suggests a SQL Developer bug when parsing the xmltable "for ordinality" keywords.
create or replace
package body oracle_sql_dev_v3_2_20_09_bug as
procedure minimal_example
is
temp varchar2(200);
ord varchar2(200);
begin
select
text
, ord
into
temp
, ord
from
xmltable(
'for $i in /somexml return /$i'
passing xmltype('<somexml>some_text</somexml>')
columns
ord for ordinality,
text varchar2(200) path '/somexml'
--,ord varchar2(200) path '/somexml'
);
end minimal_example;
procedure example
is
begin
null;
end example;
end oracle_sql_dev_v3_2_20_09_bug;