Toad World® Forums

View Script Formatting - Toad for Oracle 12.11.0.95

Have searched for answers on this forum, unable to find the specific answer. Apologies if I missed it.

Issue: Using the Describe Objects feature (clicking F4 on view name) and Script (with Views > Format UNCHECKED), results in:

Create or replace view X_view

(column_1,column_2,column_3)

as

select

– header comment1

– header comment2

x1 column_1,

x1 column_2,

x1 column_3

from table;

**What I need: **

Create or replace view X_view

(column_1,

column_2,

column_3)

as

select

– header comment1

– header comment2

x1 column_1,

x1 column_2,

x1 column_3

from table;

If Format is CHECKED then the column names are aligned as desired, but the content of the select statement are skewed all over the place (i.e., the comments, and many of the lines are split into separate lines).

Create or replace view X_view

(column_1,

column_2,

column_3)

as

select

– header comment1

– header comment2

x1

column_1,

x1

column_2,

x1

column_3

from table;

In Toad for Oracle 12.10.0.30, I was able to leave the Format option CHECKED, and the format came out formatted like this:

Create or replace view X_view

(column_1,

column_2,

column_3)

as

select

– header comment1

– header comment2

x1 column_1,

x1 column_2,

x1 column_3

from table;

Any hints are appreciated. It is very difficult to read the views in my current Toad version. :frowning:

It looks like we are formatting the view twice when that checkbox is checked. I don’t know why that makes those comments right-align but it does. Maybe there is a formatter setting that can be changed in 12.11 to fix that (Andre would know, he’ll probably reply soon).

I noticed that this was still happening in Toad 13 beta, so it is fixed there (I mean, I only format once now. it still does the same thing if you manually format the view twice in the Editor).

BTW, ‘FROM TABLE’ as the last tokens of the statement generates a parse error because it expects something like TABLE(…). But that should not influence the described behavior.

Using default formatter options, after the first formatting I got:

CREATE OR REPLACE VIEW X_view
(
column_1,
column_2,
column_3
)
AS
SELECT – header comment1
– header comment2
x1 column_1, x1 column_2, x1 column_3 FROM table2;

and when formatting again I got

CREATE OR REPLACE VIEW X_view
(
column_1,
column_2,
column_3
)
AS
SELECT – header comment1
– header comment2
x1 column_1, x1 column_2, x1 column_3 FROM table2;

which then got stable.

Aligning the comments right is controlled by the option Comments -> Align at the right margin. The default is checked.

Looks a bug to me. Queued for resolution. (QP-2794)

Thanks,
Andre