Skip to content
koustappPublic

About

Real-time PL/SQL checks in the Oracle APEX code editor: Oracle errors, 26 rules, quick fixes, column completion.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

PLLint

PLLint logo

A Chrome / Edge / Firefox extension for Oracle APEX. It checks the PL/SQL code in the builder's code editor (REST / ORDS handlers) in real time and flags problems before you have to test the API.

  • Real Oracle errors (unknown identifier, syntax...): the code is sent to your own server, which parses it without executing it (DBMS_SQL.PARSE).
  • 21 local rules (plus the checks that Oracle itself makes): UPDATE / DELETE without WHERE, SELECT INTO without error handling, COMMIT inside a loop, SQLERRM inside SQL, = NULL, TO_DATE without format, concatenated dynamic SQL...
  • Type checks on your variables (no database needed): a text in a NUMBER, a text in a DATE, a text too long for its VARCHAR2, a number that does not fit NUMBER(p,s), a variable compared with a literal of another type.
  • Checks on the columns of your tables (browser only: they read the description of your tables from your own server): a text longer than its column (ORA-12899) or too many digits (ORA-01438), NULL for a NOT NULL column, an INSERT that forgets one (ORA-01400), a number compared with a text column (the column is converted: no index, ORA-01722), a text compared with a DATE, and WHERE UPPER(name) = ... or TRUNC(date) = ... on an indexed column (the index cannot be used).
  • One-click quick fixes (lightbulb) for nine rules: declare a variable (with a type that follows the value), = NULL to IS NULL, SQLERRM through a variable, add an EXCEPTION section, add the SQL%ROWCOUNT test, re-raise instead of swallowing, remove the quotes around a number or put them around one, write a date as an exact literal.
  • Blocks the button while a red error remains (Shift + click to force): "Apply Changes" on a REST handler, "Run" in SQL Commands, "Save and Compile" in the Object Browser, and in Page Designer the "Run Page" icon and the "OK" of a code editor dialog (the editors of processes, queries, dynamic actions... are checked as soon as they open).
  • Every rule is adjustable (disabled, info, warning, error) in the options page, and the settings can be exported / imported to share them with the team.
  • Column completion: after alias. the columns of the table, with their type, NOT NULL and comment. APEX already completes table names, so only columns are added.
  • Table names right after from : in the SQL and PL/SQL editors, as soon as you type the space after FROM, JOIN, INSERT INTO, MERGE INTO or UPDATE, PLLint proposes the tables and views of your schema, kept in a cache. (On APEX 26.1 the editor's own list did not answer typed words and had to be opened with Ctrl+Space.) The list also opens again after a backspace that brings the cursor back to such a spot (from |, alias.|).
  • Suggestions while typing: in the SQL and PL/SQL editors (never in strings, comments, or JavaScript / CSS / HTML editors), if APEX's editor has Monaco's "quick suggestions" off, PLLint turns them on so that the list opens by itself as you type. If APEX already has them on (as on APEX 26.1), nothing is changed. It can be switched off in the options, which puts the editor back exactly as APEX had it.
  • A command-line linter with the same rules, for CI and Git hooks (see below).

Status: beta. Developed and tested on Oracle APEX 26.1. Other APEX / ORDS / Oracle versions have not been tried: run the SQL script on a test schema first.

Installation in 3 steps

1. Database side (once per schema)

In SQL Workshop > SQL Scripts, in the schema that owns your handlers, run sql/install.sql. It is the only script to run. It creates the verification package, a package that describes the tables of your schema (with its exclusion list), the guard REST module (validation, and the names and columns of your tables), its OAuth2 protection, an OAuth client and two views (pllint_keys, pllint_alias). Every step must show "Statement processed". It can be run again: it recreates the REST module, and your existing key stays valid.

Get your key: in SQL Workshop > SQL Commands, run

SELECT client, pllint_key FROM pllint_keys;

(pllint_team is the team key. If you get ORA-00942, the view could not be created: use the fallback query at the bottom of the script.)

The view contains your keys' secrets, like USER_ORDS_CLIENTS. Never grant privileges on it to another schema.

Test the protection, without a key:

curl -i -X POST "<address of your REST services>/guard/validate" -H "Content-Type: application/json" -d '{"code":"BEGIN NULL; END;"}'

It must answer 401. If it answers 200, do not use the module.

Your schema's structure, and how to keep it private

The script lets the extension ask your server for the names of your tables and views, their columns, indexes and column comments (never any row data): that is what feeds column completion and the list of tables. Anyone who holds a key can ask for them.

  • To hide some objects (a LIKE pattern, \ is the escape):
INSERT INTO pllint_schema_exclude (pattern) VALUES ('SALARY\_%');
COMMIT;
  • To not expose the structure at all: before running the script, in STEP 3, change c_expose_schema CONSTANT BOOLEAN := TRUE; to FALSE. The validation of your code keeps working; there is simply no completion of tables and columns.

Then, in the options, Test connection says "Column completion and the list of tables are ready." Reload your APEX page, type select x. from <a table> x and put the cursor after the dot.

2. The extension

  1. Chrome / Edge: chrome://extensions > enable Developer mode > Load unpacked > select the extension folder. Firefox: about:debugging > This Firefox > Load Temporary Add-on > select extension/manifest.json (temporary: it is removed when Firefox closes).
  2. Open the extension's options (Chrome: Details > Extension options; Firefox: Manage extension > Preferences).

3. The key

  1. Open your APEX page in the browser (the builder, any application).
  2. Click the PLLint icon in the toolbar and paste the key > Connect to this site.

That's all: PLLint takes the server address from the page you are on, Chrome asks permission for your APEX site only (accept), the connection is tested ("Connection OK ✓"), and if the address needs adjusting it searches the right one by itself. Then reload your APEX page.

How PLLint finds your REST address by itself

The REST alias (the "rest" of /ords/rest/) is a name chosen when your schema was enabled for ORDS. It is not in the address of SQL Workshop pages, so PLLint tries the likely names and checks each one against your server, without sending your key:

  1. the alias carried by the key, when your database can read it (SELECT * FROM pllint_alias;);
  2. your schema name (ORDS' default alias), also carried by the key;
  3. common names (rest, api, apex, app, ords, v1);
  4. what the address of the page you are on suggests.

A guess only counts if your server really answers like the PLLint module (the protected guard module answers 401 there and 404 for a path that cannot exist). Your key is never sent to a guess.

If your alias is none of these, the popup shows an "Address of one of your REST services" field: paste any REST address you use (for example https://host/ords/my_alias/guard/validate) and click Connect again. This happens once.

If you see Token refused (HTTP 404) or (HTTP 405), the server address is wrong (a wrong key would give 401; 405 usually means the ORDS root). The connection test then searches by itself: it probes the plausible addresses on your site without any credential (the protected guard module answers 401 only at the right address), keeps the first one that answers, and saves it. Your key is never sent to a guessed address. If nothing is found, paste the address of one of your REST services (for example https://host/ords/alias/guard/validate) in the options.

Why not detect the address automatically from the database? Because a database does not know the public address of your APEX (the browser or a proxy does). The database provides the alias, the browser the server.

How it works, and what leaves your browser

APEX editor (Monaco)  ──►  local rules (inside the browser, nothing is sent)
        │
        └─►  extension  ──►  YOUR APEX/ORDS server  (POST /guard/validate, OAuth2 token)
                              └─ DBMS_SQL.PARSE: analysis without execution
  • Your handlers' code is sent only to your own server, never to a third party. The extension has no server of its own.
  • The extension is active only on your key's site (permission requested when you save the key).
  • The server only verifies code that starts with DECLARE, BEGIN, SELECT or WITH. Everything else (including DROP, CREATE...) is refused without being analyzed, because parsing a DDL statement executes it.
  • The key contains the client_id, the client_secret and your schema alias (sometimes the server address) (base64, not encrypted): it is a secret. It only opens /guard/validate: no data can be read or changed with it. The schema part of sql/install.sql also lets the same key list the structure of your schema (names of tables and columns, their types, indexes, column comments: /guard/schema/columns/<table>, /guard/schema/tables). Never any row data, and the objects matching a pattern of PLLINT_SCHEMA_EXCLUDE are never returned. On a database whose structure must stay private, set c_expose_schema to FALSE before running the script.

Command-line linter (CI, Git hooks)

The same local rules, on files, with no browser and no dependency (Node 18+):

node cli/lint.js src/                        # a folder is searched recursively (.sql .pls .pks .pkb ...)
                                             # (after `npm link`, the command is also available as `pllint`)
node cli/lint.js --ords handlers/*.sql       # REST handlers: enables the handler rules
node cli/lint.js --fail-on warning src/      # exit code 1 from the first warning (default: errors only)
node cli/lint.js --format github src/        # GitHub Actions annotations (also: json)
node cli/lint.js --config settings.json src/ # the file exported by the extension
node cli/lint.js --fix src/                  # apply the fixes that never change behaviour
node cli/lint.js --fix=all src/              # apply every quick fix (review the diff!)
node cli/lint.js --list-rules

Exit codes: 0 nothing at or above --fail-on, 1 problems found, 2 usage or file error. A file may hold several blocks separated by a line with a single /: each block is analysed on its own, with correct line numbers. --fix only changes the lines it fixes (SQL*Plus lines, comments and line endings are kept).

It is offline: it applies the local rules and cannot ask Oracle to parse the code, so it complements the extension, it does not replace it.

GitHub Actions example:

- name: Lint PL/SQL
  run: node pllint/cli/lint.js --format github --fail-on warning db/

Git pre-commit hook (.git/hooks/pre-commit):

#!/bin/sh
git diff --cached --name-only --diff-filter=ACM | grep -E '\.(sql|pks|pkb|pls)$' | xargs -r node pllint/cli/lint.js --fail-on warning

Quick fixes

Click the lightbulb (or Ctrl+. / Cmd+.) on an underlined line:

Rule Fix
undeclared-variable declares the variable: NUMBER for a number, DATE, TIMESTAMP, BOOLEAN when the value says so, otherwise VARCHAR2(4000) (adjust the type)
equals-null = NULL becomes IS NULL (<> / != become IS NOT NULL)
sqlerrm-in-sql puts SQLERRM / SQLCODE in a variable, declared and assigned before the statement
select-into-without-exception adds EXCEPTION WHEN NO_DATA_FOUND to the block (in a REST handler it answers :status := 404)
rowcount-unchecked adds IF SQL%ROWCOUNT = 0 THEN ... END IF; after the statement (404 in a REST handler)
when-others-null replaces NULL by RAISE so the error is no longer swallowed
assign-type-mismatch / compare-type-mismatch '33' in a number becomes 33; '2026-12-02' in a DATE becomes DATE '2026-12-02' (or TO_DATE(..., format) when it has a time)
column-literal-type the same two fixes for a column, and code = 5 on a text column becomes code = '5' (only for a plain integer: 007 or 1e3 would change meaning)

The fixes that need a decision of yours insert a -- TODO line. Nothing is ever applied without your click.

Share your settings

Options page > Share your settings > Export settings saves your rules and blocking settings in a small JSON file; Import settings loads one. A file that is not a settings file is refused and changes nothing. The same file works with cli/lint.js --config.

Keys

A key is pll1. + base64 of {client_id, client_secret, ORDS alias, optionally the server address}. It is a secret (base64 is not encryption). It opens /guard/validate (analysis without execution, DDL refused) and, unless c_expose_schema is FALSE, the structure of the schema, never row data. List the keys with SELECT client, pllint_key FROM pllint_keys; (one per pllint_* OAuth client; no GRANT on that view).

Team key (pllint_team, made by sql/install.sql) One key per person (sql/new_key.sql, client pllint_<first_last>)
A member leaves rotation: everyone pastes the new key delete their client, nobody else changes
Who did what unknown identifiable by client
Leak risk grows with the team one person

Send a key through a private channel, never commit it (a test fails if a key or token is in a file). Revoke one person: see the end of sql/new_key.sql. Revoke the team key: delete the pllint_team client, run step 4 of sql/install.sql again, redistribute.

Message Cause
Key missing / Invalid PLLint key no key saved, or truncated / badly copied
Token refused (HTTP 401) revoked key or wrong secret
Validation refused (HTTP 403) the client lost the pllint_role role
Token / Validation refused (HTTP 404 or 405) wrong server address: Test connection searches the right one and saves it; otherwise paste the address of one of your REST services in the options
Server address missing no address in the key and the "Address of your APEX" field is empty
Permission refused Chrome did not grant access to the site

Uninstall

sql/uninstall.sql (database side), then remove the extension from your browser.

Known limitations

  • Browser: Chrome or Edge 111 or later, or a recent Firefox (128 or later). Chrome shows a harmless warning, background.scripts requires manifest version 2 or lower: that key is there for Firefox, and Chrome ignores it.
  • Editor: the builder must use Monaco (verified on APEX 26.1). Older APEX versions with CodeMirror are not supported.
  • Page detection: based on the page address: resource-handler for REST handlers, sql-workshop for SQL Commands and the Object Browser (both verified on APEX 26.1; please report it if your pages use another address). Elsewhere, the ORDS rules and the blocking of buttons are inactive; everything else works.
  • Page Designer: detected by page-designer in the address (for a code dialog opened as an iframe, the address of the page around it). Only SQL and PL/SQL editors are checked there (a JavaScript, CSS or HTML editor is ignored), like SQL Workshop it has no handler-only rules. "Run Page" is blocked by an error in any open editor of the page; "OK" only by the editor of its own dialog (an "OK" button exists on many dialogs: one outside a code dialog is never touched). Some code cannot be verified by Oracle as an anonymous block: a function body (RETURN value) or code with APEX substitutions (&ITEM., #COLUMN#). If Oracle complains about it, the message is only an info ("please check"), never a blocking error. A function body that starts with RETURN is not sent to the server at all (only the local rules apply).
  • SQL Workshop: the ORDS-specific rules (TRUNCATE / DROP, :status...) and the handler-only ones (SELECT *, SQL%ROWCOUNT) are switched off there. Code with several statements is not sent to the server. "Run" checks the whole editor, even if you only run the selected text: use Shift + click to run anyway. The Object Browser must use Monaco too, otherwise nothing happens there.
  • Table names: only for the tables and views of your own schema, only on the space typed after from, join, insert into, merge into or update (not after a paste or a click, not for EXTRACT(year FROM ...), FOR UPDATE or SELECT ... INTO variable), and the list is kept 5 minutes. Ctrl+Space and typed words stay with APEX's list, so that no table is shown twice. If the script was not run again since this list exists (or c_expose_schema is FALSE), nothing is offered (and the server is left alone for a few minutes).
  • Suggestions while typing: PLLint never opens the list by hand. A list opened by hand that finds nothing freezes on "No suggestions." and is not asked again while you type the next letters (Monaco, suggestModel._onNewContext); APEX's editor has nothing to offer for an empty word, so opening it right after from broke the suggestions of the letters that followed (version 0.12.3, withdrawn).
  • Column completion: only after alias. (or table. when the table has no alias), for the tables of your own schema (the one that owns the REST handlers). Not offered: tables of another schema (hr.employees e), subquery or WITH aliases, quoted names ("MyTable"), bare column names without a qualifier. A table description is kept 5 minutes: after changing a table, wait a little or reload the page. If the server is not reachable, or the schema part is not installed, nothing is suggested (and the server is left alone for a few minutes).
  • Rules on columns: they use the description that your server gives for your own schema's tables, and only judge what that description proves. They stay silent for a table of another schema (hr.employees), a table the server does not know or an excluded one, an alias that is used twice, a column without qualifier when the statement names two tables, and an expression (code = 5 + 1): only a whole literal against a whole column is judged, in WHERE, ON, SET and INSERT ... VALUES. A value too long or NULL in an INSERT ... VALUES is an error (that statement always runs); in an UPDATE it is a warning (it only fails when a row is touched). A text column compared with a number is a warning (it fails only if a row holds text). insert-missing-column also needs tr (an enabled insert trigger can fill the column, as APEX's sequence triggers do) and stays silent when the server does not give it. The description is kept 5 minutes: after ALTER TABLE, wait a little or reload the page. At most 8 tables are asked about per analysis. The command-line linter has no schema, so it does not apply them. Switch them off in the options (category Columns and indexes): nothing is then asked of the server.
  • Type checks: they only use what the block itself says (its DECLARE sections). A variable is judged only when its type is simple and certain (NUMBER, VARCHAR2(n), DATE, TIMESTAMP...), and only against a single literal ('33', 12), never an expression. %TYPE, records, collections, :binds and code with local subprograms are not judged. (The columns of your tables are judged by the column rules below.) A text that can never be a number ('abc') or a text too long for its VARCHAR2 is an error (it fails at run time); a text that converts today but depends on the session settings ('33' in a number, a text in a DATE) is a warning.
  • One Oracle error at a time (the first one): this is a limit of DBMS_SQL.PARSE.
  • Binds (:body, :status...): the extension replaces them with variables so that the parse can detect errors. When Oracle reports a type problem on a line containing a bind, it is shown as info (please check).
  • The local rules rely on text patterns, not a real PL/SQL parser: they prefer staying silent over flagging wrongly. Report any false positive (see CONTRIBUTING.md).
  • Code longer than 32,767 characters: not verified by Oracle.
  • One server per key (a single APEX server at a time).
  • Buttons are recognized by their label (English; French "Appliquer les modifications" as an example): add yours in the options.

Development

node --test        # no dependency at all (Node 18+)

See CONTRIBUTING.md to add a rule or a test handler. Privacy: PRIVACY.md.

Source and issues

https://github.com/koustapp/pllint: report a problem (with the rule id and the smallest code that shows it) as an issue.

License

Released under the MIT License. Copyright (c) 2026 Koust.

Credits

Developed by Koust, together with Claude (an AI assistant made by Anthropic): Claude wrote most of the code under Koust's direction, and every feature was tested by Koust on a real Oracle APEX installation. This project is not affiliated with or endorsed by Anthropic. The logo was generated with an AI image tool, then cleaned up (transparent background, amber badge, icon sizes).

Disclaimer

PLLint is an independent project. It is not affiliated with, endorsed by or sponsored by Oracle. Oracle, APEX (Oracle Application Express) and ORDS (Oracle REST Data Services) are names of Oracle products, used here only to say what the tool works with.

About

Real-time PL/SQL checks in the Oracle APEX code editor: Oracle errors, 26 rules, quick fixes, column completion.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages