Formatting CASE statements

Answered

I'm having trouble aligning END correctly when I'm formatting a CASE statement. It seems like END gets automatically indented.

What currently happens vs what I'm expecting:

SELECT
a,
b,
CASE
WHEN example IS NULL
THEN 'Small'
WHEN example = 'Small'
THEN 'Small Part Time'
WHEN example = 'Medium'
THEN 'Medium Practice'
END AS practice_size,
d
FROM example_table


SELECT
a,
b,
CASE
WHEN example IS NULL
THEN 'Small'
WHEN example = 'Small'
THEN 'Small Part Time'
WHEN example = 'Medium'
THEN 'Medium Practice'
END AS practice_size,
d
FROM example_table

0
1 comment

Hello,

Please open "Settings/Preferences | Editor | Code Style | SQL | General - Expressions - CASE clause" and set "Align END" to "Align with CASE".

0

Please sign in to leave a comment.