Updated 31 March 2022

Ever get a SQL statement from someone, desperate for your help?

There are 2 things that drive me nuts in these situations:

  • they send a SCREENSHOT of their code
  • they send the Query as a single line of text

If I’m in the command line, it’s real easy to fix the 2nd problem.

Just use the FORMAT command in Oracle SQLcl.

Disclaimer #1: No one sent me this code, this was just the first thing I found in my history that was on a single line…

Disclaimer #2: Don’t send me screenshots of your code.

Oh, I forgot to qualify the schema name...
Oh, I forgot to qualify the schema name…

Short, simple, sweet.

Want leading commas, instead? Cue that religious debate…but you can get that, if you want.

Grabbing your formatter rules from SQL Developer

Go to the Preferences dialog, and move to the Formatter section. You’ll find an Export button there. Click that. Take that file, and use the ‘format rules’ command.

Here’s a quick demo, on Windows:

Ugly code in, pretty code out!
Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

Write A Comment