How To: Configure TABs in SQL Developer

As often happens, my ideas for blog posts are provided by end users asking for help. Sometimes I know the answer, sometimes I don’t. This is one of the latter cases. Chet AKA @oraclenerd asked me:

‘Tell me how to find the preference in sqldev to make a tab 2 spaces?’

I knew it had to be in there somewhere. This is a pretty basic setting for any word processor or IDE. Basically you want to control how many spaces are inserted when you hit the TAB key.

The default is ‘2.’

The problem with default settings is that they are likely to make half the users happy, a third non-plussed, and the rest genuinely upset. The idea is to shoot for something that offends the least number of users and aim for ‘the right thing’, kind of like Google’s ‘Do No Harm’ motto.

Since we can’t make everyone happy, we provide options for the end user to customize and fine tune their experience. The problem here was that it was REALLY hard to find this particular option. The search mechanism in the preferences dialog doesn’t reach the page where this particular setting was stored, and the label for the setting isn’t ideal.

So let’s get down to brass tacks and show you exactly how to configure this setting in SQL Developer.

Open the preferences, go to the Database page.

Easy enough. Now click on the ‘SQL Formatting’ sub page and then on ‘Oracle Formatting.’

The Formatting Options Page for Oracle Connections

Click on the ‘Edit’ button next to the profile dropdown control

You need to open up another set of preferences to access the tab option

Go to the Indentation page and inspect the ‘Spaces’ property

It’s currently set to ‘2.’ Change it to the desired setting. If I change it to 5, when I hit the ‘tab’ key, SQL Developer will insert 4 spaces leaving the cursor on the 5th curpos on the current line.

The Spaces preferences controls the TAB key behavior

You can easily observe the new behavior in the worksheet if you enable the ‘Show Whitespace Characters’ option under the ‘Code Editor’ and ‘Display’ page in the preferences.

When we want to edit Table/View from the List on the Left Hand Pane, then it pops-up a new window which allows us to edit a existing table/view, but doesnot allow us to multi-task until we close this window.

Please suggest if there is any way to avoid this? Rather change the Preferences, and which could allow us to edit existing table/view and also open a new tab in Oracle SQL Developer and perform tasks?

Get my best SQL Developer and database advice delivered to your inbox.

Welcome

Here you will find tips and tricks for using Oracle SQL Developer, Oracle SQL Developer Data Modeler, and Oracle Database here. If you can't find what you're looking for, use the 'Ask a Question' link up top.

I'm so glad you're here! -Jeff Smith

Weekly Webcasts

I host informal webinars with the folks that build your database development tools and technologies. Recorded and available for playback on demand on YouTube.

I mostly write about working with Oracle databases, mostly. I currently work for Oracle, but I'm not an official spokesman, nor am I authorized to speak on behalf of Oracle Corp. In other words, what you read here are my words and ramblings.

If you've detected a bit of snark, that means you've been paying attention. +1 bonus credits for you!