Best practice for code readability dictates that your keywords should always be in: insert your preferred style here __________.
Here’s a Twitter poll I’m running if you want to personally weigh in:
Do you agree? Best coding practices dictate uppercase identifiers? https://t.co/WhOZvL2Bmv
— Jeff Smith ☜ (@thatjeffsmith) March 16, 2016
So even if we can’t all agree on what’s best, we can all agree that our tools should help us get the code we inherit or write in the format/shape that WE want.
Thankfully when it comes to Oracle SQL and PL/SQL, SQL Developer gives you a lot of options.
Format a Bunch of Code All At Once
So you open a file, or paste in a 1,000 line query. You want some help to make it a bit easier to read. One of the things the formatter offers is the ability to change the case of certain things.
I know that’s a little hard to see, so here’s a closer look.
You’ll notice the number of options here isn’t as robust as the Completion Insight bits I talk about next. We’re updating the formatter for version 4.2, and we’ll try to get you even more flexibility when it comes to the case of your code.
Format Code as You Type It
So this will set the case of your identifiers, you’ll see it immediately when you pull up a list of objects using the ctrl+space keyboard shortcut, but you’ll ALSO see it after you go to the next line of your code – you’ll see the case of your keywords and identifiers change based on this code editor preference.
Brute Force It
Of course the editor itself also lets you make everything UPPER, lower, or InitCaps.
Select your text, and go.
You can toggle through the 3 styles, or you can go straight to UPPER or lower.