Open hgodinez89 opened 1 year ago
The issue is still reproducible under PMD 7.0.0.
XMLTYPE is not supported when declaring vars. The XMLTYPE has several possible constructors, see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/XMLTYPE.html#GUID-59081026-A42A-4352-B5EA-A6E433A51F5E They all take the xmlData as the first parameter, which might be a string literal, as in the example here.
XMLQUERY support is only implemented on string literals (via #1685) and not identifiers, as in this example. Doc: https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/XMLQUERY.html#GUID-9E8D3220-2CF5-4C63-BDC2-0526D57B9CDB and https://docs.oracle.com/en/database/oracle/oracle-database/23/adxdb/xquery-and-XML-DB.html#GUID-39CDBF4D-258D-4CFE-AEBF-06ECD660C08D
XQuery_string is a complete XQuery expression, possibly including a prolog, as a literal string.
Apparently, the "literal string" can also be a variable... like in this example "l_tagname"...
Affects PMD Version:
This error was testing in the following versions:
Description:
Trying to analyze pl/sql code with XMLQUERY function in SELECT, PMD raises an exception error that indicates "Error while parsing".
Exception Stacktrace:
Code Sample demonstrating the issue:
Steps to reproduce:
Running PMD through: [CLI]