A RetroSearch Logo

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

Search Query:

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

[plsql] Parse error with TREAT function · Issue #5675 · pmd/pmd · GitHub

Affects PMD Version: 7.12.0

Description:

The code in https://github.com/utPLSQL/utPLSQL/blob/develop/examples/developer_examples/RunExampleTestAnnotationsParsingTimeHugePackage.sql can't be parsed.

This code uses the TREAT function which supports AS. But that is obviously not covered by PMD's PL/SQL grammar.

Exception Stacktrace:

RunExampleTestAnnotationsParsingTimeHugePackage.sql	-	ParseException: Parse exception in file 'RunExampleTestAnnotationsParsingTimeHugePackage.sql' at line 14, column 35: Encountered "AS".
Was expecting one of:
    ")" ...
    "," ...
    "=" ...
    "<" ...
    "!" ...
    "~" ...
    "+" ...
    "-" ...
    "^" ...
    ">" ...
    "OVER" ...
    "WITHIN" ...
    "||" ...
    "AND" ...
    "BETWEEN" ...
    "DEFAULT" ...
    "IN" ...
    "IS" ...
    "LIKE" ...
    "NOT" ...
    "ON" ...
    "OR" ...
    "ORDER" ...
    "MEMBER" ...
    "USING" ...
    "MULTISET" ...
    "SUBMULTISET" ...

Code Sample demonstrating the issue:

--Shows that even a very large package specification can be parsed quite quickly
--Clear Screen
set serveroutput on
set echo off
--install the example unit test packages
@@tst_pkg_huge.pks

declare
  l_suites ut_suite_items;
  l_items  ut_suite_items;
begin
  l_suites := ut_suite_manager.configure_execution_by_path(ut_varchar2_list(USER||'.TST_PKG_HUGE'));
  l_items := treat(
      treat( treat( l_suites( 1 ) as ut_logical_suite ).items( 1 ) as ut_logical_suite ).items( 1 )
      as ut_logical_suite
  ).items;
  dbms_output.put_line('Created '||l_items.count||' tests in suite');
  dbms_output.put_line('  Last test name='||l_items(l_items.last).name);
end;
/

drop package tst_pkg_huge;

Steps to reproduce:

time ~/PMD/binaries/pmd-bin-7.12.0/bin/pmd check  -d RunExampleTestAnnotationsParsingTimeHugePackage.sql --rulesets category/plsql/bestpractices.xml 

Running PMD through: CLI


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