<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Eddie Awad’s Blog - Latest Comments in Format your SQL the easy way</title><link>http://awads.disqus.com/</link><description>News, views, tips and tricks on Oracle and other fun stuff</description><atom:link href="https://awads.disqus.com/format_your_sql_the_easy_way/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Sun, 09 Nov 2008 03:34:16 -0000</lastBuildDate><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658125</link><description>&lt;p&gt;Useful links..&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sashwat Gupta</dc:creator><pubDate>Sun, 09 Nov 2008 03:34:16 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658124</link><description>&lt;p&gt;Interesting posts&lt;/p&gt;&lt;p&gt;K Rosebrook&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kristal L. Rosebrook</dc:creator><pubDate>Thu, 04 Sep 2008 03:37:57 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658123</link><description>&lt;p&gt;Hey,&lt;br&gt;from some time there is new formatting project on the web  . You can find it on  &lt;br&gt;&lt;a href="http://sqlhere.com" rel="nofollow noopener" target="_blank" title="sqlhere.com"&gt; (beta). The goals are make multi platform sql formatter with editable database of "keywords".&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">wicherqm</dc:creator><pubDate>Sun, 13 Jan 2008 14:01:42 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658122</link><description>&lt;p&gt;Hi Eddie,&lt;br&gt;finally i put into SQLinForm an option to remove linebreaks before formatting as you suggested.&lt;br&gt;Thanks for this suggestion&lt;br&gt;GuidoMarcel&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">GuidoMarcel</dc:creator><pubDate>Tue, 19 Jun 2007 16:14:47 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658121</link><description>&lt;p&gt;Has anyone posted some open source Java to format SQL statements?  I am building a tool that supports our commercial product, and I am extracting queries from the database and would like to format them.  I've written something rudimentary, but I'd like to avoid the trouble of writing a good one.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Weston Clark</dc:creator><pubDate>Wed, 21 Feb 2007 00:13:56 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658120</link><description>&lt;p&gt;To: Eddie Awad&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;I used SQL Review from &lt;a href="http://www.dbainfopower.com" rel="nofollow noopener" target="_blank" title="www.dbainfopower.com"&gt;www.dbainfopower.com&lt;/a&gt; and it it formats broken words properly (I formatted output from v$sqltext )&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">DBA</dc:creator><pubDate>Sat, 20 Jan 2007 04:14:34 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658119</link><description>&lt;p&gt;Hi Guido,&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;You've done a great job with SQLinform. Thank you.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;I have just tried formatting the SQL text mentioned in the post above. It does indeed remove the hard line breaks and format the SQL beautifully, but it looks like the line breaks are being replaced with blanks. For example:&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;pre&gt;mi&lt;br&gt;n(cols)&lt;br&gt;&lt;/pre&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;becomes&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;pre&gt;mi n(cols)&lt;/pre&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;which of course is not valid SQL.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;By the way, I'm currently using Win XP Pro.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Thanks again for this helpful utility.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eddie Awad</dc:creator><pubDate>Wed, 06 Sep 2006 18:38:10 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658118</link><description>&lt;p&gt;Hi Eddie,&lt;br&gt;thank you very much for this nice review of the sqlinform site.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Normally, the hard-coded linebreaks should be removed automatically. Which operating system are you using?&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Regards&lt;br&gt;GuidoMarcel&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">guidomarcel</dc:creator><pubDate>Wed, 06 Sep 2006 18:12:50 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658117</link><description>&lt;p&gt;Allen,&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;for example, in the following:&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;select i.obj#,i.ts#,i.file#,i.block#,i.intcols,i.t&lt;br&gt;ype#,i.flags,&lt;a href="http://i.property" rel="nofollow noopener" target="_blank" title="i.property"&gt;i.property&lt;/a&gt;,i.pctfree$,i.initrans,&lt;a href="http://i.ma" rel="nofollow noopener" target="_blank" title="i.ma"&gt;i.ma&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;I put my cursor at the beginning of the second line (just before the "y") and hit the backspace on my keyboard. I did this for every line until the whole query is on one line before I applied the formatting. That's what I meant by "remove the hard line breaks".&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eddie Awad</dc:creator><pubDate>Mon, 26 Jun 2006 17:23:08 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658116</link><description>&lt;p&gt;"Note that I had to remove the hard line breaks from the unformatted SQL before formatting it."&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;How?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">allenallen</dc:creator><pubDate>Mon, 26 Jun 2006 17:10:12 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658115</link><description>&lt;p&gt;It seems unnecessary to remove the hard line breaks from the unformatted SQL before formatting it, this free online formatter&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.wangz.net/cgi-bin/pp/gsqlparser/sqlpp/sqlformat.tpl" rel="nofollow noopener" target="_blank" title="http://www.wangz.net/cgi-bin/pp/gsqlparser/sqlpp/sqlformat.tpl"&gt;http://www.wangz.net/cgi-bi...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;it has a option to remove linebreak before beautify automatically, it works fine.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sharpe</dc:creator><pubDate>Tue, 03 Jan 2006 10:53:16 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658114</link><description>&lt;p&gt;Just to be clear, when I commented above that "just formatting (not tuning) your SQL statement has no effect on how fast or slow the statement executes" I meant that, given the following:&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;select * from employees where first_name = 'Joe'&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Does formatting the above to:&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;SELECT * &lt;br&gt;FROM employees &lt;br&gt;WHERE first_name = 'Joe'&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Make it run faster or impact performance?&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;It may or it may not. But adding an index on first_name will (if the optimizer chooses so).&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;My point was to not to rely on formatting to "tune" your SQL.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;However, as Wilfred said, the two queries may be different as far as Oracle's shared SQL area is concerned.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eddie Awad</dc:creator><pubDate>Tue, 27 Dec 2005 13:41:14 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658112</link><description>&lt;p&gt;Formatting a SQL statement can have an impact on performance. If two statements are the same but formatted diferently, they will produce a different hash value. This means they won't be able to share the same shared SQL area.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;The exception to the rule is when the paremeter CURSOR_SHARING is set to SIMILAR or FORCE. CURSOR_SHARING=FORCE was introduced in Oracle 8.1.6, whereas FORCE was introduced in version 9.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;See &lt;a href="http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14211/memory.htm#i40017" rel="nofollow noopener" target="_blank" title="http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14211/memory.htm#i40017"&gt;http://download-uk.oracle.c...&lt;/a&gt; for more info.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Wilfred</dc:creator><pubDate>Tue, 27 Dec 2005 13:16:28 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658113</link><description>&lt;p&gt;I can't believe I didn't know those tools existed :-) Great!&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;I prefer sqlReview as it allows for command line use though.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sandy Mamoli</dc:creator><pubDate>Mon, 26 Dec 2005 16:03:06 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658111</link><description>&lt;p&gt;Patrick, just &lt;strong&gt;formatting&lt;/strong&gt; (not tuning) your SQL statement has no effect on how fast or slow the statement executes, unless you (or someone else) have a proof otherwise. &lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Moreover, if you encapsulate all the needed SQL into packages, you still need to write SQL (in the package), don't you?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eddie Awad</dc:creator><pubDate>Tue, 13 Dec 2005 15:44:13 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658110</link><description>&lt;p&gt;The good thing about formatting your sql is that the Oracle parser will hash a lot of statements to the same value, which results in faster execution.&lt;br&gt;An even better thing than correctly formatting your SQL is writing no SQL at all. This can be accomplished by encapsulating all the needed SQL into packages which the other programs use.&lt;br&gt;I know this is not always possible, especially with 'legacy' code, but if you are writing new programs it's always good to think about it.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Patrick Barel</dc:creator><pubDate>Tue, 13 Dec 2005 14:09:43 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658109</link><description>&lt;p&gt;It drives me crazy the way people write SQL code. I think a lot of people let the tools write the code for them, then they don't bother to clean it up and format it. I did an article on the subject a few years ago that may be helpful to some: &lt;a href="http://www.communitymx.com/content/article.cfm?cid=C138F" rel="nofollow noopener" target="_blank" title="http://www.communitymx.com/content/article.cfm?cid=C138F"&gt;http://www.communitymx.com/...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tom</dc:creator><pubDate>Tue, 13 Dec 2005 09:51:15 -0000</pubDate></item><item><title>Re: Format your SQL the easy way</title><link>http://awads.net/wp/2005/12/12/format-your-sql-the-easy-way/#comment-3658108</link><description>&lt;p&gt;Fantastic! As useful to DBA as programmers. Thank you!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">HÃ©lio Correia</dc:creator><pubDate>Tue, 13 Dec 2005 01:23:08 -0000</pubDate></item></channel></rss>