Toad World® Forums

Formatter - alignment of mixed and/or conditions

All,

This relates to Toad for Oracle, Beta 12.12.0.16.

With this query (Version1):
select tbl.host_env
, tbl.short_name
from iib_krg.gen_tables tbl
where tbl.deleted = ‘N’
and ( ( tbl.table_type in (‘BASE’, ‘EVENT’)
and tbl.log_table1 is not null
and tbl.ignore_deletes = ‘Y’)
or tbl.table_type = ‘MASTER’
and tbl.ignore_deletes = ‘N’
and tbl.short_name <> ‘bladibla’);

The compound or statement has two predicates, each of which consists of an and-clause.
In the example above, the first OR-ed predicate is enclosed in parentheses, whereas the second one is not.
As a result, the ANDs in each predicate align fine, but due to the difference in parentheses usage, the AND clauses do not line up across the OR clause.

When I apply additional parentheses, everything lines up perfectly again:
select tbl.host_env
, tbl.short_name
from iib_krg.gen_tables tbl
where tbl.deleted = ‘N’
and ( ( tbl.table_type in (‘BASE’, ‘EVENT’)
and tbl.log_table1 is not null
and tbl.ignore_deletes = ‘Y’)
or ( tbl.table_type = ‘MASTER’
and tbl.ignore_deletes = ‘N’
and tbl.short_name <> ‘bladibla’));

It’s not really a big deal - it just looks awkward an ugly.
But if it’s too complex to fix, I can live with it.

Kind regtards,
Abe Kornelis