Let’s talk about ‘Squiggles’ – What’s Wrong with Your SQL or PLSQL?

thatjeffsmith SQL Developer 1 Comment

Tell Others About This Story:

SQL Developer’s code editors try to help you out.

They’ll show you two categories of informational advisories:

  • there is a problem with this code
  • we think we can help you with this code

These are shown by various styles of underlined text in the editor.

Let’s go through the list of what’s available as of version 18.1 – to be released, soon 🙂

Actually all of these items, save 1, are available right now in version 17.4, and have been for at least several years.

We think there’s a problem with your code.

This is the parser saying, we see potential issues. We don’t think this is going to run successfully.

There are two types of issues displayed here.

In this example, the parser is telling us two different things. To see what, simply mouse over each underlined bit of text.

If you want this, you’re gonna need a GROUP BY clause.

If you click on the ‘object_type’ blue text there, we’ll automatically add the GROUP BY clause for you.

All better 🙂

The other issue is with what you’re trying to query from – this was new for 17.4.

We don’t think this object exists.

While we were typing we went and peeked into the data dictionary for you. We couldn’t find anything called ‘USER_OBJECT.’

And also new for 18.1, if you’re working with DYNAMIC SQL, we’ll try to identify potential SQL Injection vulnerabilities.

Might not want to do that…

Remember now, these aren’t errors from the database. They might even be false positives – that is, there might not be a problem here. But we thought you should know about it.

Let’s look at two more of these helpers.

The first will be available for all Oracle connections – ‘STAR EXPLOSION.’

What’s that * really going to pull back?

You can use this to ‘peak into’ the columns, or you can click on the list and we’ll replace the * with the column list.

The second one is available for 12c and higher versions of the database, and is a feature known as SQL Text Expansion.

What’s the SQL behind your SQL, really?

Again, if you click on the blue text, we’ll replace your code with the ‘real code.’

No worries if you change your mind, both of these can be undone via the editor’s UNDO feature.

I can’t see these, or I simply don’t WANT to see these!

To turn these off –

No more advice.

To make them easier to see, for you –

Maybe green’s not the right color here, but it stands out nicely on the black background.

You want to look for the ‘disconnected join graph’ item. This is the parser’s way of saying, your math doesn’t add up correctly.

Not hints, but problems.

Syntax issues –

FORM? I think you meant FROM.

Click on the bookshelf icon, and we’ll take you to the Oracle DOCS on how to write a SQL statement.

Configure those here:

No bueno o No está bien.

PLSQL Errors –

You know how to split your editors, right?

And that color/line style is also configurable, but as PLSQL Errors.

The database, not our parser, is saying there’s a problem with your code.

Tell Others About This Story:

Comments 1

  1. Thanks Jeff, great article.

    I find that I don’t use these features as much as I would like because I’m “a keyboard guy” and find it fiddly to have to hover over the squiggles, wait for the pop up to come (which sometimes seems to take ages… or not come at all) and then click on the suggested change. It interrupts my flow too much and i often don’t bother.

    I work a lot with Eclipse and a similar feature there (called Quick Fix) can be invoked via the keyboard shortcut Ctrl+1 (or Cmd+1 on Mac). When multiple options are presented, you can select the one you want using the up/down keyboard arrows and then type Enter to apply the one selected. Very quick and handy and I use this feature a lot.

    I wish there was a similar way in SQL Developer to deal with the squiggles using the keyboard only. I have looked for a command which could be mapped via Tools > Preferences > Shortcut Keys, but I haven’t found one ( maybe I’m missing a trick?). It would be great if the « show squiggle pop up » would be added to the command list so that we could assign a shortcut to it (and if there was a way to select and apply the recommended fix with keyboard as well, otherwise there wouldn’t be much point 😉 )

    Thanks

    P.s. Maybe this is not the right place for feature requests, should I raise this on the SQL Developer Exchange?

Leave a Reply

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