There’s nothing worse than the ‘white screen of panic.’ You’re faced with the prospect of actually writing some code from scratch. Or even worse, you’re doing a presentation or demo, and everyone gets to see what a horrible typist you are.
Yes, you could browse your SQL History, but that could contain several hundred or even thousands of statements. And let’s face it, you probably don’t recognize code you wrote even a few days ago when you see it.
Wouldn’t it be nice if you could take your favorite statements or scripts, and save them to recall later? Even better, let me name and document them?
Enter the Snippets
Access your snippets via the View menu. There’s a few included ‘out of the box,’ but you’ll want to add your own to the ‘Custom’ category.
Add a Snippet
The easiest way to add a snippet is to select your code and right-click. Choose ‘Save as Snippet…’
Define the Snippet
Place it into the proper category, give it a name, and define the tool-tip that will appear if you mouse-over the snippet.
Snippets in Action
Now when you get back to the white-screen-of-panic, remember your trusty statements and scripts are accessible via the Snippets panel. Select your snippet and drag and drop (d-n-d) it into the worksheet or Procedure Editor. The d-n-d will respect any code you already have in your editor, meaning you can drag it exactly where you want to drop it and preserve your existing code.
Power Tip: Did you know you can share your favorite snippets with other SQL Developer users at the Exchange? Browse and download your favorite snippets or upload your own here. We don’t support or endorse these snippets, so use at your own risk.