SQL Formatter Options
Options
CASE
The CASE Options in the SQL Formatter Tool allow you to format CASE
statements with precision, ensuring better readability and alignment with coding standards. These settings control indentation, line breaks, and compactness for both simple and complex CASE
structures.
CASE Formatting
CASE, WHEN, THEN, ELSE, END
- Adds line breaks before these keywords in the
CASE
statement for better clarity and structure. - These options ensure each component of the
CASE
block is properly separated.
- Adds line breaks before these keywords in the
Indent CASE inside „()“
- Indents the entire
CASE
block when it is enclosed within parentheses.
- Indents the entire
Indent WHEN, THEN, ELSE
- Adds indentation to the
WHEN
,THEN
, andELSE
keywords for hierarchical alignment in nested or multi-lineCASE
statements.
- Adds indentation to the
CASE Condition
AND/OR
- Adds a line break before logical operators (
AND
,OR
) within theCASE
conditions to clearly separate them from other conditions.
- Adds a line break before logical operators (
Open „(“ / Close „)“
- Open „(„: Adds a line break before the opening parenthesis in
CASE
conditions. - Close „)“: Adds a line break after the closing parenthesis for better visibility of nested conditions.
- Open „(„: Adds a line break before the opening parenthesis in
Small CASE Statements on 1 Line
- No Break for CASE < X chars
- Keeps small
CASE
statements (e.g., under 10 characters) on a single line for compactness. - Adjust the character limit using the
-10
and+10
buttons to define what qualifies as a „small“CASE
statement.
- Keeps small
Compact vs. Expand
- Compact: Condenses
CASE
statements by reducing line breaks and indentation. - Expand: Formats
CASE
statements with more line breaks and indentation for improved readability.
How to Use These Settings
Enable or Disable Line Breaks
- Use the checkboxes for CASE, WHEN, THEN, ELSE, END to specify where line breaks should be added in
CASE
blocks.
- Use the checkboxes for CASE, WHEN, THEN, ELSE, END to specify where line breaks should be added in
Customize Indentation
- Enable indentation options like Indent CASE inside „()“ and Indent WHEN, THEN, ELSE to align keywords hierarchically within the
CASE
block.
- Enable indentation options like Indent CASE inside „()“ and Indent WHEN, THEN, ELSE to align keywords hierarchically within the
Adjust Logical Conditions
- Use the AND/OR option to structure complex conditions within
CASE
statements with line breaks and proper alignment.
- Use the AND/OR option to structure complex conditions within
Set Character Limits for Compactness
- Define a character limit for keeping small
CASE
statements on one line to maintain a balance between compactness and readability.
- Define a character limit for keeping small
Switch Between Compact and Expand Modes
- Use Compact for minimizing line breaks in short
CASE
blocks and Expand for a detailed, well-structured format.
- Use Compact for minimizing line breaks in short