Toad World® Forums

Toad Formatter Vertical Alignment

Hello,

Is there a way to achieve vertical alignment in the code using toad formatter? Following are the questions.

Is there a way to vertically align = operator for multiple AND lines?

Current Format

SELECT *
FROM table1 a, table2 b
WHERE a.col1 = b.col1
AND a.col999 = b.col999
AND a.col999999 = b.col999999

Desired Format

SELECT *
FROM table1 a, table2 b
WHERE a.col1 = b.col1
AND a.col999 = b.col999
AND a.col999999 = b.col999999

Vertical Alignment for Tabular list?

Current Format

INSERT INTO sales(prod_id,cust_id,time_id,
amount,nextcolumn,nextcolumn1)
VALUES ( product_id,customer_id,weekly_start_date,
sales_sun,nextcolumn,nextcolumn1);

Desired Format (Something like this)

INSERT INTO sales(prod_id ,cust_id ,time_id,
amount ,nextcolumn ,nextcolumn1)
VALUES ( product_id ,customer_id ,weekly_start_date,
sales_sun ,nextcolumn ,nextcolumn1);

Can we vertically align THEN values of Case statement ?

Current Format

SELECT CASE
WHEN a.col5 = b.col5 THEN 'COL5’
WHEN a.col55555555555555 = b.col5 THEN 'COL55555’
WHEN a.col555555 = b.col5 THEN 'COL555555’
WHEN a.col55555555 = b.col5 THEN 'COL5555555’
END AS VAL
FROM table1 a, table2 b
WHERE a.col1 = b.col1
AND a.col999 = b.col999
AND a.col999999 = b.col999999

Desired Format

SELECT CASE
WHEN a.col5 = b.col5 THEN 'COL5’
WHEN a.col55555555555555 = b.col5 THEN 'COL55555’
WHEN a.col555555 = b.col5 THEN 'COL555555’
WHEN a.col55555555 = b.col5 THEN 'COL5555555’
END AS VAL
FROM table1 a, table2 b
WHERE a.col1 = b.col1
AND a.col999 = b.col999
AND a.col999999 = b.col999999

Help is appreciated.

Thanks,

G.

Currently there are no options to enable all this.

The ‘=’ alignment is a request already in our queue (QP-1012). We’ll try to process it asap.

Tabular List alignment is a new enhancement request (QP-1701).

The CASE / THEN alignment is also a great suggestion (QP-1702).

Thanks,
Andre