Toad World® Forums

Formatter: always stack observation


#1

Formatter: always stack with plus, minus, mul , div etc starts in a new line

aaaaaaaaaaaaaaa :=
bbbbbbbb
+ ccccccccc
+ ddddddddd
+ eeeeeeeee;

but using in And, OR option starts in the same line

SELECT x
FROM y
WHERE a > 1 AND b > 2 AND c > 3
OR a > 1 AND b > 2 AND c > 3 AND b > 2 AND c > 3
OR a > 1 AND b > 2 AND c > 3;

I think that this last behavior should be applied also to the plus, minus, mul , div

What do you think?

Filipe Silva


#2

Hi Filipe,

Check this. I think plus, minus etc would start in the same line too, but we should only expect it when there’s WHERE leading the first operand. And for AND OR, if they’re after equal sign, they would start in new line too. If you would like to have conditions after WHERE start in a new line, I am afraid we haven’t had such an option yet. Could you please confirm whether this is what you wanted so that I could raise CR for you:).

/* Formatted on 1/15/2009 12:59:32 PM (QP5 v5.120) */
BEGIN
aaaaaaaaaaaaaaa :=
bbbbbbbb

  • ccccccccc
  • ddddddddd
  • eeeeeeeee;

SELECT x
FROM y
WHERE bbbbbbbb
+ ccccccccc
+ ddddddddd
+ eeeeeeeee = 0;

aaaaaaaaaaaaaaa :=
a > 1 AND b > 2 AND c > 3
OR a > 1 AND b > 2 AND c > 3 AND b > 2 AND c > 3
OR a > 1 AND b > 2 AND c > 3;

SELECT x
FROM y
WHERE a > 1 AND b > 2 AND c > 3
OR a > 1 AND b > 2 AND c > 3 AND b > 2 AND c > 3
OR a > 1 AND b > 2 AND c > 3;
END;


#3

I think I didn’t put my request in the easy way to understand.

I have with stacked
BEGIN
aaaaaaaaaaaaaaa :=
bbbbbbbb
+ ccccccccc
+ ddddddddd
+ eeeeeeeee;

SELECT    x
  FROM    y
 WHERE      bbbbbbbb
            + ccccccccc
            + ddddddddd
            + eeeeeeeee = 0;

aaaaaaaaaaaaaaa :=
        a > 1 AND b > 2 AND c > 3
    OR a > 1 AND b > 2 AND c > 3 AND b > 2 AND c > 3
    OR a > 1 AND b > 2 AND c > 3;

SELECT    x
  FROM    y
 WHERE        a > 1 AND b > 2 AND c > 3
            OR a > 1 AND b > 2 AND c > 3 AND b > 2 AND c > 3
            OR a > 1 AND b > 2 AND c > 3;

END;

I would want to have

BEGIN
aaaaaaaaaaaaaaa := bbbbbbbb
+ ccccccccc
+ ddddddddd
+ eeeeeeeee;

SELECT    x
  FROM    y
 WHERE      bbbbbbbb
            + ccccccccc
            + ddddddddd
            + eeeeeeeee = 0;

aaaaaaaaaaaaaaa := a > 1 AND b > 2 AND c > 3
                            OR a > 1 AND b > 2 AND c > 3 AND b > 2 AND c > 3
                            OR a > 1 AND b > 2 AND c > 3;

SELECT    x
  FROM    y
 WHERE        a > 1 AND b > 2 AND c > 3
            OR a > 1 AND b > 2 AND c > 3 AND b > 2 AND c > 3
            OR a > 1 AND b > 2 AND c > 3;

END;

the idea was that always stack would have the same beahvouir i.e start in the ‘:=’ line as it starts in ‘where’ line


#4

I get it now. It would be better if stack them in the same way.
A CR has been Created.

Thanks,
Vincent