Friday, September 14, 2012

Tool: SQL Prettry Printer

People who are students or related to programming field may some time need to work with SQL or MySQL databases. As you know when you have to work with queries then sometimes it becomes very difficult to understand a query due to bad formatting.

I am sharing a tool which makes your life easier and I also got a lot of benefit from it.

http://www.dpriver.com/dlaction.php

Above is the download link.

Below is the example which I have taken from dpdriver.com website.


SELECT   i.obj#,
         i.samplesize,
         i.dataobj#,
         Nvl(i.spare1,i.intcols),
         i.spare6,
         DECODE(i.pctthres$,NULL,NULL,
                            Mod(Trunc(i.pctthres$ / 256),256)),
         ist.cachedblk,
         ist.cachehit,
         ist.logicalread
FROM     ind$ i,
         ind_stats$ ist,
         (SELECT   enabled,
                   MIN(cols) unicols,
                   MIN(To_number(Bitand(defer,1))) deferrable#,
                   MIN(To_number(Bitand(defer,4))) valid#
          FROM     cdef$
          WHERE    obj# = :1
                   AND enabled > 1
          GROUP BY enabled) c
WHERE    i.obj# = c.enabled (+) 
         AND i.obj# = ist.obj# (+) 
         AND i.bo# = :1
ORDER BY i.obj# 

The original query is written below which I have formatted using SQL Pretty Printer tool.

select i.obj#,i.samplesize,i
.dataobj#,nvl(
i.spare1,i.intcols),i.spare6,dec
ode(i.pctthres$,null,null,mod(trunc(i.pctthres$/25
6),256)),ist.cachedblk,ist.cachehit,ist.logicalrea
d from ind$ i, ind_stats$ ist, (select enabled, mi
n(cols) unicols,min(to_number(bitand(defer,1))) de
ferrable#,min(to_number(bitand(defer,4))) valid# f
rom cdef$ where obj#=:1 and enabled > 1 group by e
nabled) c where i.obj#=c.enabled(+) and i.obj# = i
st.obj#(+) and i.bo#=:1 order by i.obj#

Hope you will like this tool and your databases queries becomes easier to understand. Please share some other tool if you know and I will surely add it on the blog.

1 comment:

  1. My Programming Zone: Tool: Sql Prettry Printer >>>>> Download Now

    >>>>> Download Full

    My Programming Zone: Tool: Sql Prettry Printer >>>>> Download LINK

    >>>>> Download Now

    My Programming Zone: Tool: Sql Prettry Printer >>>>> Download Full

    >>>>> Download LINK G3

    ReplyDelete