Well apparently you can teach an old dog new tricks. I recently sent the following email to Enkitec’s internal techie email list:
Begin forwarded message:
Have you ever tried to decipher a really ugly, unformatted SQL statement that someone gave you or you pulled out of one the database views or an AWR report? Tim Fox turned me on to the SQL formatting capability of SQL Developer a few weeks ago (actually Brian Hill found it first and showed Tim). It is awesome! It’s a little unintuitive to use though. Here’s how I use it.
1. start up the SQL Developer (there are versions for Mac OS and Windows by the way)
2. Click File->New and choose the SQL File option
– this opens a Query Builder Pane (you don’t need to connect to a database)
3. Pick any random file to open
4. Paste your nasty 10 page long query into the Query Builder pane replacing the text from your random file
5. Right click on the text in the window (brings up a long menu)
6. Click the Format menu Item (it’s at the bottom of the menu in version 3.0)
Viola – nicely formatted SQL text
The latest version of SQL Developer (3.0.x) is actually much better than the previous version by the way.
I haven’t closed SQL Developer since I found out about this capability!
SQL Developer is a free tool that can be downloaded from Oracle’s web site here:
Note version 3.1 is now available but I haven’t tried it yet.