Thursday, 2 May 2013

Clickable SQL*Plus Errors

Running lots of scripts in SQL*Plus is nice when they are working correctly. But what about when they fail?  Its a pain to figure out what went wrong, unless you have a log file and even then, you have to hunt the errors down.

Well, I've had enough of that.  Laziness has forced us to create clickable errors in the SQL Worksheet as part of SQL Developer.

Heres a simple example.  Take 3 statements, one of which has an obvious error.  Hitting F5 runs the script and the errors now appear in the script output.  Notice that they are coloured blue at this point to show us that they are clickable.

When you click on the error, you get taken to the point where you made the error in the worksheet.  In this case, line 3.  One of the things we wanted to do as much as possible when doing this was to keep tabs on the error should we change the file.  Above, I add a few lines and return to click on the error and it brings us to the right spot again. In this instance, line 5.

The same thing works in files.  If we have a problem in a nested file like @test/test.sql, the error is reported and we can click on it in the same way and be brought to the file at the appropriate line and column offset.


Gary Sze said...

I can't figure out how to enable this function in my SQL Developer.

I have tried in both SQL Develoepr v1.5.4 and v3.2.20.09 in Windows platform, but still can't get it work.

Can you share more detail on how to enable it?

Barry McGillin said...

This is on by default in 4.0 EA