Exporting Your Resultset with Data Export
SQL Developer's Data Export lets you export any resultset to CSV, XML, text, an INSERT statement, or a SQL*Loader control file with inline data. The last two formats aren't shared by many other toolsand working DBAs will find them very useful.
To export a resultset, simply right-click in the results grid and select "Export" from the context menu. After you choose your format, SQL Developer pops up a dialog box that lets you fine-tune your selection. You can export to Clipboard instead of a file, which is particularly handy for generating INSERT or SQL*Loader statements.
One particularly nice feature is the ability to export the whole resultset, a cell, a column, or a rowwhatever you select. You can also choose which columns to export, or even rewrite the query, in the Export dialog box.
However, be careful: SQL Developer exports exactly what you see. If your
NLS_DATE_SETTING defaults to 'MON-RR', then the Export statement pulls dates in MON-RR format, ignoring any greater precision stored in the database. This could be a bit of a pitfall if you're using Export to generate an INSERT statement or a SQL*Loader control file. The statement Export generates will reflect your
NLS_DATE_SETTING, not the full date in the database. Likewise, be mindful of your session
NLS_TIMESTAMP_TZ_FORMAT settings when exporting TIMESTAMP WITH TIME ZONE data.
To open a Code Editor window, navigate to a package spec, package body, procedure, or function in the Object Tree, and then either click "Open" in the context menu (right-click), or click the "Edit" icon in the view window to the right of the Connection Manager.
Like SQL Worksheet, Code Editor has syntax highlighting, SQL formatting, split panes, and auto-completion. Its other nice features include:
- Expand and collapse code sections
- Code Insight, which offers auto-complete suggestions, as in SQL Worksheet, and related tools: Ctrl-space activates completion insight; ctrl-shift-space gets you parameter insight; ctrl-alt-space gets you "smart" completion insight
All the keyboard shortcuts in SQL Developer are user-configurable via the Preferences dialog, under "Accelerators." SQL Developer also comes with a variety of useful keyboard shortcut templates, such as "Emacs", which provides keyboard shortcuts for common Emacs operations (e.g., Ctrl-Y for Yank and Meta-Y for Pop). You can change these under "Accelerators" as well.
Editing Saved Code Is a Little Ugly
Code Editor saves package specs and bodies as separate files, and I had difficulty getting it to recognize specs and bodies I'd saved as code filesthey opened in SQL Worksheet instead, or opened in Code Editor without syntax highlighting or the ability to compile. As a workaround, I ran the code in SQL Worksheet to create it, then selected the package in the Connection Manager to open it in the Code Editor. It works, but it's not pretty. I hope future releases of Raptor will make it easier to edit saved code.