Merge pull request #3107 from hvbtup:master

[plsql] Fix ParseException for EXECUTE IMMEDIATE str1||str2; #3107
This commit is contained in:
Andreas Dangel committed 2021-02-19 09:00:38 +01:00
commit 1a30468d35
4 files changed
+21 -2

No files matched your search

+4 -1
View File
@@ -26,12 +26,15 @@ This is a {{ site.pmd.release_type }} release.
* apex-documentation
* [#3075](https://github.com/pmd/pmd/issues/3075): \[apex] ApexDoc should support private access modifier
* plsql
* [#3106](https://github.com/pmd/pmd/issues/3106): \[plsql] ParseException while parsing EXECUTE IMMEDIATE 'drop database link ' || linkname;
### API Changes
### External Contributions
* [#3098](https://github.com/pmd/pmd/pull/3098): \[apex] ApexDoc optionally report private and protected
* [#3098](https://github.com/pmd/pmd/pull/3098): \[apex] ApexDoc optionally report private and protected - [Jonathan Wiesel](https://github.com/jonathanwiesel)
* [#3107](https://github.com/pmd/pmd/pull/3107): \[plsql] Fix ParseException for EXECUTE IMMEDIATE str1||str2; - [hvbtup](https://github.com/hvbtup)
{% endtocmaker %}
+1 -1
View File
@@ -2686,7 +2686,7 @@ ASTFetchStatement FetchStatement() :
ASTEmbeddedSqlStatement EmbeddedSqlStatement() :
{}
{
<EXECUTE> <IMMEDIATE> (StringLiteral() | Expression())
<EXECUTE> <IMMEDIATE> StringExpression()
[ <INTO> Name() ("," Name())* ]
[ <USING> [ <IN> [ <OUT> ] | <OUT> ] Expression() ("," [ <IN> [ <OUT> ] | <OUT> ] Expression())* ]
[ ( <RETURN> | <RETURNING> ) <INTO> Expression() ("," Expression())*] ";"
@@ -73,4 +73,9 @@ public class PLSQLParserTest extends AbstractPLSQLParserTst {
public void testCaseIssue1454() {
plsql.parseResource("CaseIssue1454.pls");
}
@Test
public void testExecuteImmediateIssue3106() {
plsql.parseResource("ExecuteImmediateIssue3106.pls");
}
}
@@ -0,0 +1,11 @@
--
-- BSD-style license; for more info see http://pmd.sourceforge.net/license.html
--
CREATE OR REPLACE PROCEDURE bar
IS
v_link varchar2(10) := 'xxx';
BEGIN
-- EXECUTE IMMEDIATE with an expression instead of just a literal or variable.
EXECUTE IMMEDIATE 'drop database link ' || v_link;
END bar;