Skip to main content

Error recovery

ZPA understands nearly all Oracle SQL and PL/SQL syntax, but a file can still contain code it cannot parse: a syntax error, a construct from a newer Oracle release, or text that is not PL/SQL at all. With error recovery, ZPA skips the statement it cannot parse and keeps analyzing the rest of the file, instead of ignoring the whole file.

Example​

The first block is missing a semicolon on line 4:

declare
x varchar2(10);
begin
x := 'foo' -- missing semicolon
end;

declare
x varchar2(10);
begin
x := 'bar';
end;
  • With error recovery, ZPA skips the first block (lines 1–5) and analyzes the second one normally. Rules report issues in the second block.
  • Without error recovery, the parse error on line 5 stops the analysis of the file: no rule reports issues in it, and the analysis log shows "Unable to parse file" with the error position.

Finding the code that was skipped​

Skipped code is not analyzed, so no rule reports issues in it. To see where this happens, activate the ParsingError rule. It is not active by default and reports every statement that ZPA skipped.

Configuration​

Error recovery is enabled by default.

  • SonarQube plugin: disable it with the analysis property sonar.zpa.errorRecoveryEnabled=false.
  • ZPA CLI: error recovery is always enabled.

If ZPA fails to parse valid Oracle code, please open an issue with a sample.