There’s an export and import button on the preferences panel where you see the
SQL Formatter settings.
From: Niall Litchfield [mailto:niall.litchfield@xxxxxxxxx]
Sent: Thursday, November 05, 2015 6:01 AM
To: jt2354@xxxxxxxxx
Cc: Maris Elsins; gogala.mladen@xxxxxxxxx; oracle-l
Subject: Re: What happened to SQL*Developer SQL Formatter?
I took your sql and ran the formatter with my preferences (commas at the
beginning of a line baby!!) and got the text below. That looks pretty
reasonable to me. I know Jeff Smith reads this group so possibly he'll know if
its possible to export/share preferences. If it isn't seems like a cool
enhancement request to enforce corporate coding styles if nothing else.
SELECT
end_time
, wait_class#
, (time_waited_fg)/(intsize_csec/100)
, ( time_waited) /(intsize_csec/100)
, 0
FROM
v$waitclassmetric
UNION ALL
SELECT
end_time
, -1
, SUM(
CASE
WHEN metric_name = 'CPU Usage Per Sec'
THEN value
ELSE 0
END) fg
, SUM(
CASE
WHEN metric_name = 'Background CPU Usage Per Sec'
THEN value
ELSE 0
END) bg
, SUM(
CASE
WHEN metric_name = 'Average Active Sessions'
THEN value
ELSE 0
END) dbt
FROM
v$sysmetric
WHERE
group_id = 2
AND metric_name IN ('Background CPU Usage Per Sec', 'CPU Usage Per Sec',
'Average Active Sessions')
GROUP BY
end_time
ORDER BY
end_time
, wait_class#
On Thu, Nov 5, 2015 at 9:21 AM, John Thomas <HYPERLINK
"mailto:jt2354@xxxxxxxxx"; \njt2354@xxxxxxxxx> wrote:
Doesn't work well though.
trailing / left hanging and long lines in SELECT or WHERE clause are not broken
up so they are readable.
I like the plain and simple
FUNCTION
(
FUNC2
(
column_name
)
)
... but have found no way of configuring SQL Dev formatter to do this. For
example, the CASE statements are OK, but what happened with the functions on
the SELECT list?
SELECT end_time, wait_class#, (time_waited_fg)/(intsize_csec/100), (
time_waited) /(intsize_csec/100), 0
FROM v$waitclassmetric
UNION ALL
SELECT end_time, -1, SUM(
CASE
WHEN metric_name = 'CPU Usage Per Sec'
THEN value
ELSE 0
END) fg, SUM(
CASE
WHEN metric_name = 'Background CPU Usage Per Sec'
THEN value
ELSE 0
END) bg, SUM(
CASE
WHEN metric_name = 'Average Active Sessions'
THEN value
ELSE 0
END) dbt
FROM v$sysmetric
WHERE group_id = 2
AND metric_name IN ('Background CPU Usage Per Sec', 'CPU Usage Per Sec',
'Average Active Sessions')
GROUP BY end_time
ORDER BY end_time, wait_class# /
Regards
John
On Thu, 5 Nov 2015 at 07:08 Maris Elsins <HYPERLINK "mailto:elmaris@xxxxxxxxx";
\nelmaris@xxxxxxxxx> wrote:
Hi,
It' s still there in SQL Developer 4.x, you can find it by right-clicking the
SQL text in the SQL sheet or hitting Ctrl+F7.
---
Maris Elsins
HYPERLINK "https://twitter.com/MarisElsins"; \n@MarisElsins
HYPERLINK "https://www.facebook.com/maris.elsins";
\nwww.facebook.com/maris.elsins
On Thu, Nov 5, 2015 at 7:56 AM, Mladen Gogala <HYPERLINK
"mailto:gogala.mladen@xxxxxxxxx"; \ngogala.mladen@xxxxxxxxx> wrote:
In version 3.x, there was a SQL Formatter in the "Edit" menu. One keystroke
would reformat horribly tangled SQL monsters. In the version 4.x, this very
useful feature is gone. Why was that done? Who decided to throw this out and
why?
Regards
--
Mladen Gogala
Oracle DBA
http://mgogala.freehostia.com
--
//www.freelists.org/webpage/oracle-l
--
Niall Litchfield
Oracle DBA
http://www.orawin.info