Toad World® Forums

Formatter question: Treatment of parenthesis for sub-queries

This may be because I don’t see enough options in the Formatter option window (it needs a scroll bar!), but is it possible for the Formatter to insert a newline after the ( and before the ) for subqueries? Like this:

Capture.jpeg

The problem I’m having is subtle but incredibly frustrating: the extra space caused by the left parenthesis in “(SELECT” forces an extra space in the alignment for the subquery’s code. This then completely breaks my ability to use TAB and SHIFT-TAB to cleanly indent/unindent sections of code, since I’ve set the tab to insert 2 spaces (this is obviously a problem for any tab setting above 1 space).

Best,

KJ

I’ll consider adding an option to do that, yes it’s true that the paren offsets the whole subselect by one to the right.

Thanks,

Andre

Thanks Andre, that’s all anyone could ask for! It would be very helpful indeed, particularly when someone has to make a simple change to a piece of sub-code (not just SELECT sub-queries) and either faces a long series of DOWN-DELETE keystrokes, or running Formatter on just that section of code and indenting it to the right depth by hand. All that is prone to error as you can imagine so everyone would love it if they could just stick to hitting TAB and SHIFT-TAB.

Toad lucks out in that the nearest competitor’s formatter – SQLComplete for SMSS – is also a bit buggy. It’s a bit of a race, though: SQLComplete has a brilliant demo mode for formatting that makes the options crystal clear and the overall intent of the formatter is more straightforward. For example, the definitions for SELECT (whose options are detailed indeed) can be immediately chosen for all other uses including UPDATE, sub-queries, MERGE, etc.

Anyway, I’d prefer to use one tool for the entire organization, which is why I’m trying to be more active here on the Toad forums. Thanks for looking.

Best,

KJ