SQL beautifier
747546Apr 13 2010 — edited Apr 13 2010Hi All
I have an application which generates SQL (and runs it). When generating the SQL it's just one long string. In some case I want to display the SQL on the screen, so that the end user (IT pesons) can take it and work on it in another environment (sql developer etc).
Does anyone know of a freeware SQL beautifier, for use in the apex application? Written in pl/sql og Javascript?
I can find plenty beautifiers on the net working from a plain HTML page, but I need the suff in my own application.
regards
Mette
SQL could be like this: (not very readable):
SELECT D, DECODE(Count(DECODE(YYYY_MM,'2009-09',CHECKED_BY,null)),0,null,Count(DECODE(YYYY_MM,'2009-09',CHECKED_BY,null))) as "2009-09" , DECODE(Count(DECODE(YYYY_MM,'2010-01',CHECKED_BY,null)),0,null,Count(DECODE(YYYY_MM,'2010-01',CHECKED_BY,null))) as "2010-01" , DECODE(Count(DECODE(YYYY_MM,'2010-02',CHECKED_BY,null)),0,null,Count(DECODE(YYYY_MM,'2010-02',CHECKED_BY,null))) as "2010-02" , DECODE(Count(DECODE(YYYY_MM,'2010-03',CHECKED_BY,null)),0,null,Count(DECODE(YYYY_MM,'2010-03',CHECKED_BY,null))) as "2010-03" , DECODE(Count(DECODE(YYYY_MM,'2010-04',CHECKED_BY,null)),0,null,Count(DECODE(YYYY_MM,'2010-04',CHECKED_BY,null))) as "2010-04" ,Count(CHECKED_BY) as "== ALL ==" FROM (SELECT * FROM ol_cust_collection_v where collection_date + 366 > sysdate) GROUP BY D ORDER BY D