0

I find that toad formatter starts the next line of code under trailing comments. Is there a way to change this. This happens regardless of wrapping/stacking options.

e.g. Original SQL:

SELECT C1, C2, C3, C4, C5 FROM DUAL 

Now I add a trailing comment after C3:

SELECT C1, C2, C3 -- this is a test
, C4, C5 FROM DUAL

Result of formatting - C4 starts below the trailing comment:

SELECT C1, C2, C3 -- this is a test
                 , C4, C5 FROM DUAL

Preferred solution - Stack the columns:

SELECT C1
     , C2
     , C3 -- this is a test
     , C4
     , C5
  FROM DUAL

Is there a setting I can use to change this?

Kind regards

fe

Decided to add another example where the comment is in the WHERE clause:

Original SQL:

SELECT C1
     , C2
     , C3
  FROM DUAL
 WHERE C1 = 1 AND C2 = 2 AND C3 = 3

Adding comment and formatting:

SELECT C1
     , C2
     , C3
  FROM DUAL
 WHERE C1 = 1 AND C2 = 2 -- this is a test
                         AND C3 = 3

Preferred solution :

SELECT C1
     , C2
     , C3
  FROM DUAL
 WHERE C1 = 1 
   AND C2 = 2 -- this is a test
   AND C3 = 3

fe

  • Open TOAD's **Options**, navigate to **Formatter** and try various options it offers. There are quite a few of them; see whether you can make it format code as you'd want it to. – Littlefoot Jan 11 '22 at 21:24
  • Thanks. Tried that already. Posting here is last resort. – Francois Evert Jan 12 '22 at 06:17

0 Answers0