Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to custom format SQL Formatter in SQL Developer 18.2?

User_FLCHVSep 26 2018 — edited Jan 14 2019

I'm currently using SQL Developer 4.1.5, and now I'm thinking to move up to SQL Developer 18.2, which i found that the formatter is "quite weird".

In 18.2, there are quite a lot of extras line spacing and line breaks, and some weird formatting happening :

-- On select clause

SELECT nvl(

   hp.organization_name_phonetic,

   (nvl(

     hp.party_name,

     hp.party_name

   ) )

) --Why the ) sign not aligned to NVL? Why there is line break at this point? And how to exclude NVL content from line breaking?

       || ' / '

       || ship_su_h.location sold_to,

       oeh.creation_date             so_date, --Why there are a lot white spaces in this alias? This is not occurred on all aliases, which is weird.

-- On where clause

WHERE mo.subinventory_code (+) IN (

  'a',

  'b',

  'c'

) -- How to exclude line break on IN clause, and let it fill until max char per line?

AND nvl(

   oeh.cancelled_flag,

   'N'

) <> 'Y'

    AND nvl(

   oel.cancelled_flag,

   'N'

) <> 'Y' --Again with weird alignment on NVL, which make it hard to read the code

If i have to compare it with 4.1.5 :

-- On select clause

SELECT NVL( hp.organization_name_phonetic, (NVL( hp.party_name, hp.party_name )

  ) ) -- It line breaking because the ) ) pass over max char per line

  || ' / ' -- it line breaking because the rule to line break concatenation

  || ship_su_h.location sold_to

  oeh.creation_date so_date, --Normal line spacing

-- On where clause

WHERE mo.subinventory_code (+) IN ( 'aaaaaaaaa', 'bbb', 'ccccccccc',

    'dddddddddd') --It line breaking because it over max char per line

  AND NVL( oeh.cancelled_flag, 'N' ) <> 'Y'

  AND NVL( oel.cancelled_flag, 'N' ) <> 'Y' --More readable lines

Is there any way to import formatting from 4.1.5 to 18.2? I need to remove all of those extra line spacing and line breaks because some of my queries has thousands of lines, and the Report Builder has limitation on how much characters I can paste into it. I've tried some 4.2 custom format workaround, but almost all lines are different in 18.2.

Or is there version with better SQL Formatting than 18.2? Like 4.2.x or 17.x?

Thank you

-- Agung S V

This post has been answered by Vadim Tropashko-Oracle on Sep 26 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 11 2019
Added on Sep 26 2018
6 comments
6,485 views