Oracle PL/SQL Formatter — Format Oracle Queries in Your Browser
Table of Contents
Oracle SQL Developer has a built-in format option (Ctrl+F7) that has not been meaningfully improved since 2014. It handles basic SELECT statements but breaks on packages with multiple procedures, deeply nested PL/SQL with cursors and exception blocks, and modern features like the JSON functions added in 21c. If you maintain Oracle databases for a living, you have probably given up on Ctrl+F7 and learned to format by hand.
Our formatter handles Oracle PL/SQL syntax in your browser. Pick the Standard SQL dialect (which handles most Oracle syntax), paste your query or package, and you get clean output that respects PL/SQL conventions — DECLARE/BEGIN/EXCEPTION/END blocks get nested indentation, cursor declarations stay readable, and DBMS_OUTPUT calls do not get squished. No SQL Developer install, no upload, no signup.
Why SQL Developer Format SQL (Ctrl+F7) Falls Short
Ctrl+F7 was good enough for SELECT statements in 2014. Modern PL/SQL has outgrown it:
- Packages with multiple procedures — the procedures inside a package body sometimes lose their nesting, making it hard to spot the boundaries between them.
- EXCEPTION blocks get flattened — WHEN OTHERS THEN handlers float at random indentation levels.
- Cursor declarations get inconsistent breaks — CURSOR c_name IS SELECT ... FROM ... WHERE ... gets crammed onto one line in some cases, broken weirdly in others.
- JSON functions (21c) — JSON_OBJECT, JSON_ARRAYAGG, JSON_TABLE — Ctrl+F7 does not understand these and treats them as plain function calls.
- Hierarchical queries (CONNECT BY) — START WITH and CONNECT BY clauses lose their visual hierarchy.
- Hint comments (/*+ ... */) — optimizer hints sometimes get separated from the SELECT they belong to.
Our formatter addresses each of these and runs in any browser tab without launching SQL Developer.
Oracle PL/SQL Syntax Our Formatter Handles Cleanly
Use the Standard SQL dialect for Oracle queries — it handles the vast majority of Oracle syntax correctly:
PL/SQL block structure — DECLARE, BEGIN, EXCEPTION, END blocks get proper nested indentation. Nested blocks (BEGIN inside BEGIN) maintain their levels.
Cursor declarations — CURSOR c_employees IS SELECT ... FROM ... formats with the SELECT statement properly indented under the cursor name.
FOR loops over cursors — FOR rec IN c_cursor LOOP ... END LOOP gets the loop body indented.
Exception handling — WHEN NO_DATA_FOUND THEN, WHEN TOO_MANY_ROWS THEN, WHEN OTHERS THEN — each handler gets its own line with the action indented.
Package and procedure declarations — CREATE OR REPLACE PACKAGE BODY with multiple PROCEDURE and FUNCTION declarations gets clear separation between each member.
Hierarchical queries — SELECT ... FROM ... START WITH ... CONNECT BY PRIOR ... gets proper line breaks at START WITH and CONNECT BY.
Optimizer hints — /*+ INDEX(t idx_name) */ stays attached to the SELECT it belongs to.
Analytic functions — RANK() OVER (PARTITION BY ... ORDER BY ...) and other window functions format with one clause per line.
MERGE statements — MERGE INTO target USING source ON ... gets clear separation between the matched and not matched branches.
DBMS_OUTPUT calls — DBMS_OUTPUT.PUT_LINE() calls inside PL/SQL blocks stay on their own lines, properly indented to the block level.
How to Format an Oracle Query or PL/SQL Block in Your Browser
- Copy your query, package, or procedure — from SQL Developer, Toad, SQLPlus, or wherever you write Oracle code.
- Paste it into the formatter input — handles up to ~500KB of code.
- Set dialect to Standard SQL — this handles most Oracle syntax correctly. The PL/SQL block structure works under any dialect setting, but Standard gives the cleanest output.
- Pick indent — 2 spaces is the Oracle community standard — Oracle's own docs use 2 spaces for PL/SQL examples.
- Toggle uppercase keywords — Oracle conventions use uppercase. Leave it on.
- Click Format — output appears with syntax highlighting. Copy back into SQL Developer or save as a .sql file.
For packages, paste the entire CREATE OR REPLACE PACKAGE BODY at once — the formatter will handle the whole package as one unit and preserve the structure.
Sell Custom Apparel — We Handle Printing & Free ShippingReal PL/SQL Formatting Wins You Get From This Tool
Multi-procedure packages. A package body with 10 procedures and 5 helper functions becomes navigable when each procedure gets a clear visual boundary.
Cursor-driven loops. FOR rec IN (SELECT ... FROM ... WHERE ...) LOOP ... END LOOP gets the inline cursor SELECT properly indented and the LOOP body clearly nested.
Exception handlers. A BEGIN block with 5 different EXCEPTION handlers (NO_DATA_FOUND, TOO_MANY_ROWS, DUP_VAL_ON_INDEX, OTHERS, plus a custom one) gets each handler on its own line with the action visible.
Hierarchical org-chart queries. START WITH manager_id IS NULL CONNECT BY PRIOR employee_id = manager_id gets clear line breaks so you can spot the recursion direction.
MERGE for slowly-changing dimensions. MERGE INTO with WHEN MATCHED THEN UPDATE SET ... and WHEN NOT MATCHED THEN INSERT (...) VALUES (...) becomes readable for ETL devs.
Oracle PL/SQL Formatter Comparison
| Tool | Cost | PL/SQL Support | Install Required |
|---|---|---|---|
| Hawk SQL Formatter (this tool) | Free | Standard dialect handles most Oracle syntax | None — runs in browser |
| SQL Developer Ctrl+F7 | Free with SQL Developer | Basic, breaks on packages | SQL Developer install |
| Toad for Oracle Format Code | Toad license (~$1000+/year) | Excellent | Toad install |
| PL/SQL Developer Beautifier | ~$216 license | Strong | PL/SQL Developer install |
| JetBrains DataGrip | $229/year | Strong | DataGrip install |
| VS Code + Oracle SQL Developer extension | Free | Limited | VS Code install |
If your shop already has Toad licenses, Format Code there is the gold standard. For everyone else who wants quick formatting without an install, the browser tool is the cleanest free option.
Other Browser Tools Oracle DBAs Use
Oracle DBAs do a lot more than write queries. These browser tools handle adjacent tasks:
JSON formatter — Oracle 21c added robust JSON support. When you query a JSON column, paste the result into the JSON formatter for a tree view.
SQL diff checker — compare two versions of a query before deploying using the SQL query diff tool.
Cron expression generator — Oracle Scheduler uses cron-style expressions. Generate them visually with our cron generator.
Code diff checker — compare two versions of a stored procedure across environments using the code diff tool.
Try It Free — No Signup Required
Runs 100% in your browser. No data is collected, stored, or sent anywhere.
Open Free SQL FormatterFrequently Asked Questions
Does this formatter understand PL/SQL package bodies?
Yes. CREATE OR REPLACE PACKAGE BODY with multiple PROCEDURE and FUNCTION members gets clear separation between members. The DECLARE/BEGIN/EXCEPTION/END structure inside each procedure gets nested indentation.
Will the formatter run my query against my Oracle database?
No. This is text-only formatting that runs in your browser. It does not connect to Oracle or any database. Your query, package, or procedure never leaves your device. Safe for production code.
Does it handle the CONNECT BY hierarchical query syntax?
Yes. SELECT ... FROM ... START WITH condition CONNECT BY PRIOR child = parent gets proper line breaks at START WITH and CONNECT BY. The PRIOR keyword stays in place.
What about optimizer hints in /*+ ... */ comments?
Optimizer hints stay attached to the SELECT they belong to. The /*+ ... */ comment block does not get separated from the keyword that follows it.
Can I format an Oracle 21c JSON_TABLE query?
Yes. JSON_TABLE, JSON_OBJECT, JSON_ARRAYAGG, and JSON_VALUE all format correctly. The COLUMNS clause inside JSON_TABLE gets clear indentation with each column on its own line.

