Are you missing the feature to record and playback a macro in SQL-Developer?
Well, it’s there, just a bit hidden!
[Update: If you use SQL Developer version 4.01 or newer please read this post: Using macros – Update for version 4.01 ++]
Activate the macro functions
- Select “Tools/Preferences” from the main menu.
- Select “Shortcut Keys” in the list on the left.
- Enter “macro” the right search field.
- Assign “Ctrl+Period” to “Macro Playback”. Period is the “.” key on your keyboard.
- Assign “Ctrl+Shift+Period” to “Macro Toggle Recording”.
Record a macro
To start the recording of the macro, use an editor window of SQL-Developer and press the keys control (ctrl), shift and period (.) together.
The status bar on the bottom shows “Keystroke recording started.”
Any key you will press from now on will be recorded for replay through this macro.
When you are done press the keys control (ctrl), shift and period (.) together again.
The status bar on the bottom shows “Keystroke recording ended.”
There is only one drawback: You can only have one macro at a time. When you record a new macro the previous macro is gone!
Use the macro
Just press the keys control (ctrl) and period (.) together and your macro gets played back.
Adding quotes and commas to a list
Ever wanted the get rid of manually adding quotes and commas to a list of strings?
With a macro it is easy to get from this:
Here is how:
- Go to the first line of the list.
- Start the recording by pressing the keys control (ctrl), shift and period (.) together.
- Press the following keys (pos1) (‘) (end) (‘) (,) and (“arrow down”) one after each other.
- End the recording by pressing the keys control (ctrl), shift and period (.) together again.
- Play back the macro by pressing the keys control (ctrl) and period (.) together.
- Repeat step 5 until the list is done.