A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/1731 below:

[pslql] ParseException when parsing ELSIF · Issue #1731 · pmd/pmd · GitHub

Affects PMD Version: 6.12.0

Description:
I’m trying to test PMD with PLSQL and I’m getting an error when parsing

When I use IF whitout ELSIF it works fine but when I use it i got an exception.

Exception stacktrace
net.sourceforge.pmd.PMDException: Error while parsing C:\sapatin\pmd-bin-6.12.0\update_planned_hrs.sql
        at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:99)
        at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:51)
        at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:78)
        at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:24)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: net.sourceforge.pmd.lang.plsql.ast.ParseException: Encountered " <UNSIGNED_NUMERIC_LITERAL> "2 "" at line 15, column 11.
...

Code Sample demonstrating the issue:

CREATE OR REPLACE PACKAGE BODY update_planned_hrs
IS

FUNCTION existing_planned (p_emp_id IN NUMBER, p_project_id IN NUMBER) RETURN NUMBER

IS

existing_hours NUMBER(4);

BEGIN
   IF  1 = 1   THEN
    
     null;
     
   ELSIF 2 = 2  THEN
     null;
   ELSE
     null;
     
   END IF;


   RETURN (existing_hours);

   EXCEPTION
          WHEN OTHERS THEN NULL;

   END existing_planned;
   

END update_planned_hrs;
/

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Running from command line with JDK 11.
pmd -d C:\pmd-bin-6.12.0\test -l plsql -R rulesets/plsql/TomKytesDespair.xml -f xml


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4