SQL formatting


Eddie Awad has a nice blog about three apps to format your SQL code. Especially the online tools, SQLinForm en the Online SQL Formatter, are very nice. Both offer some options to select the SQL dialect and the output format (e.g. upper/lowercase) and language (SQL, VB, Java etc). The former, being a java applet, is more feature-rich than the latter. Example:

select ename from (select ename from emp order by sal desc) where rownum < 4


SELECT ename
    ( SELECT ename
    FROM emp
    ORDER BY sal desc
WHERE rownum < 4

About Author

Aino Andriessen is a consultant on Enterprise Java, ADF, PL/SQL, XML, and SOA development and is Expertise Lead on Application Lifecycle Management (ALM). He has a strong interest in ADF, SOA, Maven, architecture, quality management, delivery and application lifecycle management. Aino publishes on the AMIS technology blog and has been a presenter at the ODTUG Kaleidoscope, Oracle Open World and UKOUG TechEbs.


  1. colour-coded sql testing on

    SELECT   Last_Name,
    FROM     Employees
    WHERE    Salary &lt  ANY (SELECT   Salary
                            FROM     Employees
                            WHERE    Job_Id = ‘it_prog’
                            ORDER BY 2)
             AND Job_Id &lt&gt ‘it_prog’
    ORDER BY 1

  2. Scott Mitchell on

    Cool, I’ve been missing the SQL formatter in SQL*Navigator ever since I changed jobs. The option to download Online SQL Formatter and integrate it into our build is very tempting… Thanks for the pointers!