SQL Formatting Settings


← SQL Formatter overview

← PL/SQL Formatter overview

Contents


The Editor › SQL Format (tree) settings page controls how the SQL Formatter lays out query clauses. Settings are arranged in a two-level property tree. Every row can be edited entirely from the keyboard.

Each row has up to two editable parts:

The horizontal splitter bar between the two sides can be dragged with the mouse to resize the columns.

Category headers (Short-line heuristics, Miscellaneous) can be collapsed or expanded by clicking the [−] / [+] button or by pressing Left / Right when the header row is selected.

Keyboard navigation

Key Action
↑   ↓ Move the selection up or down one row.
Home   End Jump to the first or last visible row.
Left If the focused row is an expanded category header, collapse it. Otherwise moves selection up (same as ↑).
Right If the focused row is a collapsed category header, expand it. Otherwise moves selection down (same as ↓).
Space Toggle the checkbox of the focused row on or off. Has no effect on rows that have no checkbox (Block max length, CASE WHEN max length, Log errors max length).
Enter Open the numeric edit field of the focused row for in-place editing. Press Enter again (or Tab) to confirm and close the field. Has no effect on rows that have no numeric field.
Escape If a numeric field is currently open for editing, discard the change and close the field. If no field is open, close the settings dialog (equivalent to clicking Cancel).
Tab Move keyboard focus out of the property tree to the next control in the dialog (the OK or Cancel button). If a numeric field is open it is committed first, then focus leaves the tree.
Shift+Tab Move keyboard focus to the previous control in the dialog.
Tip: Changes only take effect after you click OK. Clicking Cancel or pressing Escape (when no field is being edited) discards all unsaved changes.

Settings reference

Short-line heuristics

These settings control when the formatter keeps a SQL clause on a single line instead of expanding it vertically. For each clause, the checkbox enables the feature and the number sets the maximum total line length that still qualifies as “short”.

Setting Default Description
Simple statement ✓ 60 Keep a complete, self-contained short statement (e.g. a brief SELECT 1 FROM DUAL) on one line.
SELECT column list ✓ 40 Keep a short SELECT column list on one line.
FROM table list ✓ 40 Keep a short FROM clause on one line.
GROUP BY list ✓ 60 Keep a short GROUP BY list on one line.
ORDER BY list ✓ 60 Keep a short ORDER BY list on one line.
SELECT subquery ✓ 60 Keep a short inline SELECT subquery on one line.
Block max length 60 Maximum line length for other parenthesised blocks. This row has no checkbox; the limit is always active.
CASE WHEN max length 40 Keep a short WHEN clause on one line. Set to 0 to always expand CASE expressions vertically.
RETURNING max length 60 If the entire RETURNING … INTO … clause fits within this length it is kept on one line. Set to 0 to always expand.
RETURNING max items 5 Maximum number of items per line when a RETURNING or INTO sub-list is wrapped. Set to 0 for no item-count limit.

Miscellaneous

Setting Default Description
Align column aliases ✓ Vertically align the AS aliases of SELECT list columns so they form a neat column.
Blank line before set ops ✓ Insert a blank line before UNION, INTERSECT, and MINUS operators to visually separate the query blocks.
Align SET assignments ✓ Vertically align the right-hand sides of SET clause assignments in UPDATE statements.
Align CASE in SET ✓ When Align SET assignments is on, also align CASE expressions that appear as the right-hand side of a SET assignment so their bodies line up with the other values.
Log errors max length 40 Maximum line length used when formatting log error output.

Brick list

Brick list mode packs SELECT column lists and INSERT column / VALUES lists into a compact rectangular block instead of placing each item on its own line. See also Brick list mode (SELECT) and Brick list mode (INSERT).

Setting Default Description
Enabled ✓ Master switch. When off, all brick-list settings are ignored and the formatter uses normal one-item-per-line layout for every column list.
Max line length 80 Maximum total line length for a brick row. When adding the next item would push the line past this limit, a new brick row is started.
Max items per line 10 Upper bound on the number of items placed on a single brick row, regardless of line length. Set to a large value (e.g. 99) to let the line-length limit alone decide.
Min items to activate 5 Minimum number of items in the list before brick layout is used. Lists with fewer items fall back to normal one-item-per-line layout even when brick mode is enabled.
Linked INSERT col / VALUES ✓ When on, the VALUES list wraps at the same item positions as the INSERT column list so that each value appears directly beneath its column name. Applies to both standalone INSERT statements and the INSERT action inside a MERGE. See Linked brick — column list and VALUES list.
Linked UNION / INTERSECT / MINUS ✓ When on, every SELECT branch in a compound query wraps its column list at the same positions as the first branch, so corresponding columns align vertically across all branches. See Linked brick layout across set-operation branches.

PL/SQL

Formatting options specific to PL/SQL blocks, subprograms, and packages.

Setting Default Description
Blank lines around complex DECLARE items ✓ Insert a blank line before and after each cursor, type, or nested-subprogram declaration inside a DECLARE section. Simple variable declarations are not affected.
Blank line around flow-control statements ✓ Insert a blank line around IF, LOOP, CASE, and nested block statements to visually separate them from surrounding statements.
Blank line around subprograms ✓ Insert a blank line around consecutive subprogram bodies (procedures and functions) inside a package body or type body.
Blank line after unit header ✓ Insert a blank line after the header line of a package or type spec/body, and before its optional initialization section (the closing BEGIN) when one is present.
Blank line around DML statements ✓ Insert a blank line around consecutive SQL statements (or a SQL statement and the next PL/SQL statement) at the same block nesting level.
Blank line before comment ✓ Insert a blank line before a comment, subject to the general comment/blank-line policy: no double blank lines are produced, only the first of a run of consecutive comments receives a separator, and no blank line is ever inserted after a comment.
IS/AS on new line   When on, break IS/AS onto its own line instead of keeping it on the same line as the subprogram or package/type header.
Expression max length 80 Maximum line width for a math or boolean expression before it is wrapped onto multiple lines. A value of 0 disables wrapping.
Param list max length 80 Maximum line width for a call or header parameter list before it is wrapped onto multiple lines. A value of 0 disables wrapping.
Align param list to paren   When on, wrapped parameter-list continuation lines align under the column following the opening ( instead of using one block-indent level.
Concatenation max length 80 Maximum content width for a || concatenation chain before it is wrapped onto multiple lines. A value of 0 disables wrapping.
Keep mixed concat pair together ✓ When wrapping a concatenation chain, never break at a || that crosses a literal-to-variable boundary.
Break between literal concat pairs ✓ Always break a literal || literal transition onto a new continuation line, regardless of the current line width.
Keep end-of-line comments on their code line ✓ A -- comment that annotates a line of code stays on that line instead of being moved onto a line of its own. When off, every end-of-line comment is emitted below the code it annotates (the behaviour of earlier releases).
End-of-line comment max column 120 Widest line that may still host a kept end-of-line comment. If keeping the comment on its code line would push that line past this column, the comment is demoted onto a line of its own instead. A value of 0 (or less) disables the width check.

← SQL Formatter overview

← PL/SQL Formatter overview