SQLcl – Setting Up the Formatter

thatjeffsmith SQL Developer 6 Comments

Tell Others About This Story:

Just because you’re in a command line interface doesn’t mean you’re stuck with ugly code!

Wait, if it’s my code, you’re stuck with ugly code.

But if it’s YOUR code, then you’re not stuck with poorly formatted code.

You can of course use the FORMAT command to format what’s in a file or in the SQLcl buffer.

I don’t like the formatter default settings!

Have no fear.

Load up the GUI.


Set your preferences.

Save them.

Set it and forget it?

Go back to SQLcl, load the formatter rules.

remember, you have HELP for each command and for each SET[ting] in SQLcl!

Before the format…

I want leading commas!

Ok, let’s format that.

Most of you will hate this formatting scheme.


Note I did with this the latest copy of SQLcl – updated just LAST WEEK – and a pre-production version of version 4.2 of SQL Developer which you folks will be able to get access to later this year.

Here’s SQLcl using formatter settings applied from EA2, so that SHOULD work for those of you using the EA.

My code’s not ugly, YOUR code is ugly 🙂

Related Posts

Tell Others About This Story:

Comments 6

  1. I tried exporting the XML from SQL Developer 3.20 and using it in sql.exe 18.3. The file loads correctly (“Formatter rules loaded”), but doesn’t seem to have any effect. I even tried removing all unnecessary profiles from it, but still the formatting works with some general rule set. For example, I enabled line breaks before commas, but it is inserted after them.

    1. thatjeffsmith Post
    2. OK, so I obviously used some ancient version of SQL Developer which has a completely different system. Strange to see sql.exe not writing any errors instead!

      Also it feels that that old version had more granular options.

    3. thatjeffsmith Post
  2. Hi,
    In SQL Developer there are two files related to formatting. One is XML from advanced option and another is custom formatting with file extension prg. How to set both if I have modified advanced format and custom format as well?

    Thanks Robert

    1. thatjeffsmith Post

Leave a Reply

Your email address will not be published. Required fields are marked *