Formatting Keywords to UPPERCASE In Oracle SQL Developer

I received this question from a customer today, and it took me more than a few minutes to remember where this preference was located in SQL Developer. This tells me that the topic is ripe for blogging :)

How do I go FROM:

select *
from scott.emp
where ename like '%JEFF%'


SELECT      *
     FROM scott.emp
     WHERE ename LIKE '%JEFF%'

It’s all in the formatting

You need to access the formatting preferences under the Tools menu. It takes a bit of navigating to get there, so bear with me:

  • Tools
    • Database
      • SQL Formatter
        • Oracle Formatting
        • Click ‘Edit’ on the profile
        • Other
          • Case change: ‘Keywords Uppercase’

It’s easy to find once you know where to look?

You can tell it to leave the case alone, upper everything, upper only the keywords, lower everything.

Accessing the Formatter Options

We allow separate formatting options for different RDBMS. You need to make sure you’re accessing the ‘Oracle Formatting’ page in the preferences. You can then choose to edit the default options OR you can do what I have done – save the defaults as a new set of options. I’ve called my profile ‘JeffCustom.’ I can now switch back and forth now through different sets of formatting options.

You need to hit the ‘Edit’ button to get to the formatting options editor. A good number of people seem to miss this.

Select your profile, then hit the ‘Edit’ button

But I Don’t Want to Use the Formatter, I Want it to Change as I Type!

I do enjoy a demanding user :) Especially when I have a good answer for them! Open your preferences again, and this time go to the Code Editor page. Select ‘Completion Insight.’ Look at the bottom of the preferences page now:

Change the case of the keywords as you type…presto changeo!

We’re relying on our parser to correctly identify the keywords here, so the words will change AS the parser recognizes them. This means they might not change right way, but rather as the SQL statement you’re working on gets closer to completion.