ThatJeffSmith

SQL Developer Quick Tip: Accessing SQL History with the Keyboard

When I’m doing my ‘Tips and Tricks’ show, there is at least one trick that is guaranteed to get the audience’s attention:

I’m in an editor – INSERT MAGIC – wham! I’m cycling through the SQL History list, no need to use the mouse.

The white screen of panic, no code, NO CODE!

Here’s a set of keyboard shortcuts I want you to memorize RIGHT NOW:
Ctrl+Down — Next
Ctrl+Up — Previous

The concept of ‘Next’ and ‘Previous’ will depend on the sort order defined in the View – SQL History (F8) dialog. I have mine sorted to Timestamp DESC, so that when I go to ‘Next’, I’m going backwards in time. If I want the query I executed 5 iterations ago, that’s CTRL+Down+Down+Down+Down.

Configure what 'previous' and 'next' mean before you start!

Now before you try this, keep in mind this will CLOBBER your workspace.

So once you get the hang of Down and Up, thrown in a SHIFT to your Ctrl+ keystroke. This will APPEND the SQL to the worksheet instead of clobbering the text.

UNIX command-line fiends already should know this trick, using the Up and Down arrow keys to recall previous commands.