This is a command-line interface to the Z PL/SQL Analyzer. It is a code analyzer for Oracle PL/SQL and Oracle Forms projects.
Official releases are available for download on the "Releases" page.
- Java 21 or newer
Currently, the zpa-cli supports these options:
--sources: [required] Path to the folder containing project files. Defines the complete project source/context set.--files: One or more files to analyze, separated by space (e.g.--files a.pks b.pkbor repeated--files a.pks --files b.pkb), or-to read from standard input. Relative paths are resolved relative to--sources. Absolute paths are accepted only when they resolve inside--sources. For normal analysis, every target must be a member of the discovered sources under--sources. When omitted, all supported files discovered under--sourcesare analyzed.--syntax-only: Validates PL/SQL syntax only. Bypasses normal coding rules, custom plugin loading, Forms metadata, and project semantic preparation. When used with explicit--files, only the specified targets are resolved and parsed without recursively discovering the rest of the project.--stdin-filename: Virtual filename for source identity when reading from stdin (--files -). Must reside inside--sourcesand have a supported extension. Defaults tostdin.sql.--fail-on: Failure threshold for the exit code (none,any,syntax,blocker,critical,major,minor,info). In normal analysis mode, the default isnone. When--syntax-onlyis requested without--fail-on, the default threshold issyntax. An explicit--fail-on noneoverrides this default in syntax-only mode.--forms-metadata: Path to the Oracle Forms metadata file.--extensions: File extensions to analyze, separated by comma. The default value issql,pkg,pks,pkb,fun,pcd,tgg,prc,tpb,trg,typ,tab,tps.--output-format: Format of the output. Supported formats:console,json,sq-generic-issue-import. The default value isconsole.--output-file: Path to the output file. When specified withjson, writes the report to the file without writing to stdout.--config: Path to the configuration file. The file format must comply with the provided JSON schema. You can refer to the example zpa-config-example.json for guidance. If the configuration file is not provided, only the rules marked as "activated by default" will be executed.--type-report: Path of a JSON file to write the Oracle type report to. It does not change the analysis output. Not available with--syntax-only.--oracle-url,--oracle-user,--oracle-password-env,--oracle-schemas,--oracle-relations,--compilation-schema: optional Oracle database metadata settings.
--sourcesdefines the complete project context. All discovered project files are used for project declaration index preparation and cross-file semantic resolution.--filesoptionally restricts the files that are actually scanned for diagnostics and reported. Filesystem targets must be a subset of discovered project sources (filesystemTargets ⊆ discoveredProjectSources).- stdin limitation: Standard input (
--files -) is currently supported only with--syntax-only. Project-aware semantic analysis with stdin requires project-overlay support, which is deferred to a future milestone.
console: writes human-readable analysis results to standard output, grouped by file and sorted deterministically, including position, severity, rule key, and message.json: outputs a deterministic, schema-versioned machine-readable JSON document (schemaVersion: 1). Safe to pipe: stdout contains only JSON (when--output-fileis not used), while logs and progress messages go to stderr.validation:{ "passed": boolean, "threshold": string }. Authoritative validation outcome matching exit code 0 (passed: true) vs 1 (passed: false) against the configured--fail-onthreshold. Diagnostics may exist whenvalidation.passedis true (e.g. with--fail-on none).diagnostics: list of findings sorted stably by normalized file, range, rule, and message:kind:"SYNTAX"(parse/syntax diagnostics fromParsingErrorCheck) or"RULE"(standard coding rules).file: normalized file path relative to--sources.range:{ "startLine": int?, "startColumn": int?, "endLine": int?, "endColumn": int? }ornullfor file-level issues. Coordinates:startLineis 1-based,startColumnis 0-based,endLineis 1-based,endColumnis 0-based exclusive. Unavailable coordinates are represented asnull.rule: rule identifier (e.g.zpa:ParsingError,zpa:PackageBodyParameterNocopy).severity:"BLOCKER","CRITICAL","MAJOR","MINOR","INFO".message: localized diagnostic message.
sq-generic-issue-import: generates a JSON file using SonarQube's "Generic Issue Data" format that can be used in SonarCloud or in a SonarQube server.
0: analysis completed without an enabled validation failure (threshold not exceeded)1: requested validation condition failed (findings met or exceeded the--fail-onthreshold)2: invalid invocation, command-line arguments, or target file error (e.g. nonexistent target file, target outside--sources, stdin used without--syntax-only)3: execution failure, including Oracle metadata acquisition failures (driver missing, connection refused, invalid credentials)
By default, zpa-cli never connects to a database. With --oracle-url, it reads table and view column metadata from an Oracle database once, before scanning, in a single read-only transaction, and closes the connection; the analysis uses only that detached snapshot.
--oracle-url: JDBC URL, e.g.jdbc:oracle:thin:@//db.example.com:1521/FREEPDB1. It must not contain credentials.--oracle-user: database user.--oracle-password-env: name of the environment variable holding the password (defaultZPA_ORACLE_PASSWORD). The password is never accepted as an argument.--oracle-schemas: comma-separated schemas to read completely (exact dictionary names, usually upper case). A schema is only treated as complete when it is the connected user's own schema; other schemas are read as far as the user can see them, and names not found there stay inconclusive.--oracle-relations: comma-separatedSCHEMA.RELATIONnames to read individually.--compilation-schema: the schema in which analyzed units without an explicit owner compile (CREATE PACKAGE pkg). It is distinct from the schemas read: a unit written asCREATE PACKAGE hr.pkgalways compiles inHR. Without it, unqualified units are reported as having no schema context.
These options cannot be combined with --syntax-only. Errors never print the password or the URL.
The Oracle JDBC driver is not bundled. Copy ojdbc17.jar (Maven Central com.oracle.database.jdbc:ojdbc17, tested with 23.26.3.0.0) to the drivers directory of the zpa-cli distribution. With the Docker image, mount it at /opt/zpa-cli/drivers/ojdbc17.jar.
--type-report types.json writes every %TYPE/%ROWTYPE reference in the project's package declarations (variables, constants, subtypes, record fields, collection elements, parameters and function returns) with:
file,startLine(1-based),startColumn(0-based),declaration,kind,role,elementand the writtenreference;compilationSchema: the schema used to read the reference;status:RESOLVED, or an inconclusive status:UNAVAILABLE(no metadata),SCHEMA_CONTEXT_MISSING,INCOMPLETE(the metadata does not cover the name),RELATION_NOT_FOUND(no table or view of that name was read; Oracle may still resolve it, e.g. through a synonym),COLUMN_NOT_FOUND,CAPTURE_NOT_EXCLUDED,AMBIGUOUS,CONFLICT,SOURCE_INCOMPLETE,NOT_EXTERNAL, with anote;- for resolved
%TYPE:relationandtype(Oracle datatype, e.g.NUMBER(10,2),VARCHAR2(40 CHAR)); for resolved%ROWTYPE:rowFieldsin column order (invisible columns excluded).
The report covers all files under --sources, also when --files restricts the diagnosed files. Rules and their findings are unaffected.
./gradlew oracleIntegrationTest runs the CLI against a real Oracle database (never part of build). It creates and drops disposable users through an administrative account given by ZPA_ORACLE_JDBC_URL, ZPA_ORACLE_ADMIN_USER and ZPA_ORACLE_ADMIN_PASSWORD; the tests are skipped when they are unset.
Full project analysis:
zpa-cli --sources .Focused human validation:
zpa-cli --sources . --files src/packages/customer.pkbFocused machine validation:
zpa-cli --sources . --files src/packages/customer.pkb --output-format jsonSyntax validation:
zpa-cli --sources . --files src/packages/customer.pkb --syntax-onlyStdin validation:
cat generated.sql | zpa-cli --sources . --files - --stdin-filename src/packages/customer.pkb --syntax-onlyOracle type report:
export ZPA_ORACLE_PASSWORD=... # read from the environment only
zpa-cli --sources . --oracle-url jdbc:oracle:thin:@//db.example.com:1521/FREEPDB1 --oracle-user HR \
--oracle-schemas HR --compilation-schema HR --type-report zpa-types.jsonRunning an analysis:
./zpa-cli/bin/zpa-cli --sources . --output-file zpa-issues.json --output-format sq-generic-issue-import
Then you can send the results to a SonarCloud or SonarQube server setting the sonar.externalIssuesReportPaths property:
sonar-scanner
-Dsonar.organization=$SONARCLOUD_ORGANIZATION \
-Dsonar.projectKey=myproject \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.externalIssuesReportPaths=zpa-issues.json
Check the demo project on SonarCloud!
Please read our contributing guidelines to see how you can contribute to this project.