About the SQL Statement Formatter

SQL Statement Formatter is a Java applet that formats SQL statements to a consistent format. The motivation to write the applet came from reading many complicated and ill-formatted SQL statements at customer sites. Also many monitoring utilities and the V$SQLTEXT view strip linefeeds, so even nicely formatted statements are shown as unintelligible text. What I needed was an easily accessible utility for formatting the statements to a more readable format. Well, Java turned out be productive language for developing the utility and applets the most accessible way to deploy it.

Just cut and paste a SQL statement in the field and click the "Format" button, and the formatted statement will appear in the same field. The current version understands only SELECT statements and supports most Oracle syntax (see the limitations below). Note that the formatter accepts many illegal statements and formats them happily. For example, the formatter does not have any access to data dictionary, and can't validate that columns and tables exist. It is not intended for checking syntax.

Syntax not supported currently

The future plans are to support complete SQL DML syntax and provide formatting options such as keywordCase (upper/lower/unchanged), keywordColor and indentationLevel. The SQLFormatter class could be delivered as a Java Bean, so other Java applications and applets could use it. The formatting options could be implemented as fields in the Java Bean to make it configurable.

keywordCase
keywordColor
identifierCase
identifierColor
indentationLevel

The applet has only been tested using Netscape 4.0.4 on Windows. If you encounter any problems with the applet, please send email to support@deepbase.nospam.com.