Re: What happened to SQL*Developer SQL Formatter?

From: Patrice sur GMail <patrice.boivin_at_gmail.com>
Date: Wed, 11 Nov 2015 09:06:48 -0400
Message-ID: <CACH2ED+6ni8mZzU=WOjBMhhdotbTnH-YNNS8v1UR_7ssNrjAcA_at_mail.gmail.com>



I don't envy whoever builds the formatter, I've seen SQL and PL/SQL code which is more than 10 pages long when printed on paper.

Sometimes the high IQ researchers here mix in standard SQL into their code, too. LOL

On Tue, Nov 10, 2015 at 5:44 PM, John Hallas <John.Hallas_at_morrisonsplc.co.uk
> wrote:

> I find commas at the beginning of a line so unsightly. Never understand
> why some people like them. J
>
>
>
> *From:* oracle-l-bounce_at_freelists.org [mailto:
> oracle-l-bounce_at_freelists.org] *On Behalf Of *Niall Litchfield
> *Sent:* 05 November 2015 11:01
> *To:* jt2354_at_gmail.com
> *Cc:* Maris Elsins; gogala.mladen_at_gmail.com; 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 <jt2354_at_gmail.com> 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 <elmaris_at_gmail.com> 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
>
> _at_MarisElsins <https://twitter.com/MarisElsins>
>
> www.facebook.com/maris.elsins
>
>
>
>
>
>
>
> On Thu, Nov 5, 2015 at 7:56 AM, Mladen Gogala <gogala.mladen_at_gmail.com>
> 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
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>
>
>
>
>
> --
>
> Niall Litchfield
> Oracle DBA
> http://www.orawin.info
>
> ______________________________________________________________________
> Wm Morrison Supermarkets Plc is registered in England with number 358949.
> The registered office of the company is situated at Gain Lane, Bradford,
> West Yorkshire BD3 7DL. This email and any attachments are intended for the
> addressee(s) only and may be confidential.
>
> If you are not the intended recipient, please inform the sender by
> replying to the email that you have received in error and then destroy the
> email.
> If you are not the intended recipient, you must not use, disclose, copy or
> rely on the email or its attachments in any way.
>
> This email does not constitute a contract in writing for the purposes of
> the Law of Property (Miscellaneous Provisions) Act 1989.
>
> Our Standard Terms and Conditions of Purchase, as may be amended from time
> to time, apply to any contract that we enter into. The current version of
> our Standard Terms and Conditions of Purchase is available at:
> http://www.morrisons.co.uk/gscop
>
> Although we have taken steps to ensure the email and its attachments are
> virus-free, we cannot guarantee this or accept any responsibility,
> and it is the responsibility of recipients to carry out their own virus
> checks.
> ______________________________________________________________________
>

-- 


-- Patrice
My profiles: [image: Facebook]
<http://www.facebook.com/home.php?#!/profile.php?id=100000206805521>[image:
LinkedIn] <http://ca.linkedin.com/pub/patrice-boivin/a/933/5a9>[image:
Twitter] <http://www.twitter.com/PatriceBoivin>

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Nov 11 2015 - 14:06:48 CET

Original text of this message