<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Beware of Comments in SQL</title>
	<atom:link href="http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/</link>
	<description>News, views, tips and tricks on Oracle and other fun stuff</description>
	<pubDate>Sat, 11 Oct 2008 23:37:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: Eddie Awad</title>
		<link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51693</link>
		<dc:creator>Eddie Awad</dc:creator>
		<pubDate>Mon, 15 Oct 2007 19:53:33 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51693</guid>
		<description>Good one Coskan. By the way, Gary and William, I have fixed the formatting in the comments, so the line breaks and the /* */ are preserved.</description>
		<content:encoded><![CDATA[<p>Good one Coskan. By the way, Gary and William, I have fixed the formatting in the comments, so the line breaks and the /* */ are preserved.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: coskan</title>
		<link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51687</link>
		<dc:creator>coskan</dc:creator>
		<pubDate>Mon, 15 Oct 2007 11:58:37 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51687</guid>
		<description>and what about this :)

http://coskan.wordpress.com/2007/04/23/oracle-idiosyncrasies-2/</description>
		<content:encoded><![CDATA[<p>and what about this <img src='http://awads.net/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://coskan.wordpress.com/2007/04/23/oracle-idiosyncrasies-2/" rel="nofollow">http://coskan.wordpress.com/2007/04/23/oracle-idiosyncrasies-2/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pythian Group Blog &#187; Blog Archive &#187; Log Buffer #66: a Carnival of the Vanities for DBAs</title>
		<link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51676</link>
		<dc:creator>Pythian Group Blog &#187; Blog Archive &#187; Log Buffer #66: a Carnival of the Vanities for DBAs</dc:creator>
		<pubDate>Fri, 12 Oct 2007 16:40:54 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51676</guid>
		<description>&lt;p&gt;[...] Awad reminds us, beware of comments in SQL. Beware also of SQL injection. It is no laughing matter, I assure you. Nonetheless, Andrew Clarke [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[&#8230;] Awad reminds us, beware of comments in SQL. Beware also of SQL injection. It is no laughing matter, I assure you. Nonetheless, Andrew Clarke [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Robertson</title>
		<link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51664</link>
		<dc:creator>William Robertson</dc:creator>
		<pubDate>Wed, 10 Oct 2007 23:30:27 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51664</guid>
		<description>&lt;p&gt;...only with the line breaks I posted left in...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8230;only with the line breaks I posted left in&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Robertson</title>
		<link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51663</link>
		<dc:creator>William Robertson</dc:creator>
		<pubDate>Wed, 10 Oct 2007 23:29:22 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51663</guid>
		<description>&lt;p&gt;Well, duh ;)&lt;/p&gt;

&lt;p&gt;Though it did remind me of the colleague who couldn't work out why he got a "missing expression" error with something like this:&lt;/p&gt;

&lt;p&gt;EXECUTE IMMEDIATE
    'SELECT --+ FULL(e) ' &#124;&#124;
    '       COUNT(*) ' &#124;&#124;
    'FROM   emp e ' &#124;&#124;
    'WHERE  e.empno = 42' INTO v;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Well, duh <img src='http://awads.net/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Though it did remind me of the colleague who couldn&#8217;t work out why he got a &#8220;missing expression&#8221; error with something like this:</p>
<p>EXECUTE IMMEDIATE<br />
    &#8216;SELECT &#8211;+ FULL(e) &#8216; ||<br />
    &#8216;       COUNT(*) &#8216; ||<br />
    &#8216;FROM   emp e &#8216; ||<br />
    &#8216;WHERE  e.empno = 42&#8242; INTO v;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eddie Awad</title>
		<link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51662</link>
		<dc:creator>Eddie Awad</dc:creator>
		<pubDate>Wed, 10 Oct 2007 22:43:33 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51662</guid>
		<description>&lt;p&gt;William, sure, if you want to be picky :) I can be even pickier: "Beware of double hyphen style comments in Oracle Forms LOV definitions".&lt;/p&gt;

&lt;p&gt;But, I can think of at least a couple of situations that have nothing to do with LOVs in Oracle Forms and where double hyphen style comments inside SQL can cause problems.&lt;/p&gt;

&lt;p&gt;While debugging ColdFusion web applications, the SQL used in these applications is logged, usually as a long string with no line breaks. Having a double hyphen comment in the middle of it will cause a problem when trying to execute it as is. I usually need to edit the SQL first, which is a hassle. I think this is indirectly related to Gary's comment above.&lt;/p&gt;

&lt;p&gt;The second situation is, well, rather simple. For example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SQL&#62; select * from dual;

D
-
X

SQL&#62; select * -- comment here from dual;
select * -- comment here from dual
                                 *
ERROR at line 1:
ORA-00923: FROM keyword not found where expected


SQL&#62; select * /* comment here */ from dual;

D
-
X
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Powel also shared an interesting thing about &lt;a href="http://pbarut.blogspot.com/2007/10/comments-in-sqlplus.html" rel="nofollow"&gt;comments in SQL*Plus&lt;/a&gt;.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>William, sure, if you want to be picky <img src='http://awads.net/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> I can be even pickier: &#8220;Beware of double hyphen style comments in Oracle Forms LOV definitions&#8221;.</p>
<p>But, I can think of at least a couple of situations that have nothing to do with LOVs in Oracle Forms and where double hyphen style comments inside SQL can cause problems.</p>
<p>While debugging ColdFusion web applications, the SQL used in these applications is logged, usually as a long string with no line breaks. Having a double hyphen comment in the middle of it will cause a problem when trying to execute it as is. I usually need to edit the SQL first, which is a hassle. I think this is indirectly related to Gary&#8217;s comment above.</p>
<p>The second situation is, well, rather simple. For example:</p>
<pre><code>SQL&gt; select * from dual;

D
-
X

SQL&gt; select * -- comment here from dual;
select * -- comment here from dual
                                 *
ERROR at line 1:
ORA-00923: FROM keyword not found where expected

SQL&gt; select * /* comment here */ from dual;

D
-
X
</code></pre>
<p>Powel also shared an interesting thing about <a href="http://pbarut.blogspot.com/2007/10/comments-in-sqlplus.html" rel="nofollow">comments in SQL*Plus</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Robertson</title>
		<link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51661</link>
		<dc:creator>William Robertson</dc:creator>
		<pubDate>Wed, 10 Oct 2007 22:10:27 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51661</guid>
		<description>&lt;p&gt;So you mean, "Beware of comments in Oracle Forms LOV definitions"? That's not the same thing as "Beware of Comments in SQL".&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>So you mean, &#8220;Beware of comments in Oracle Forms LOV definitions&#8221;? That&#8217;s not the same thing as &#8220;Beware of Comments in SQL&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eddie Awad</title>
		<link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51660</link>
		<dc:creator>Eddie Awad</dc:creator>
		<pubDate>Wed, 10 Oct 2007 15:14:29 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51660</guid>
		<description>&lt;p&gt;Matt, thanks for your tip too. I agree with you, hardcoding should be avoided. However, the query above is not the actual query that is used in the form. I just used a simple query here for demonstration purposes and to illustrate the problem that we faced.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Matt, thanks for your tip too. I agree with you, hardcoding should be avoided. However, the query above is not the actual query that is used in the form. I just used a simple query here for demonstration purposes and to illustrate the problem that we faced.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51659</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Wed, 10 Oct 2007 14:14:34 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51659</guid>
		<description>&lt;p&gt;Huh, I've never experienced that so thanks for the tip.  However, the biggest sin he committed was hard-coding a value instead of referencing the block.field value.  Think of the noobs who will see this and do the same.  ;)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Huh, I&#8217;ve never experienced that so thanks for the tip.  However, the biggest sin he committed was hard-coding a value instead of referencing the block.field value.  Think of the noobs who will see this and do the same.  <img src='http://awads.net/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eddie Awad</title>
		<link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51654</link>
		<dc:creator>Eddie Awad</dc:creator>
		<pubDate>Tue, 09 Oct 2007 22:30:53 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-51654</guid>
		<description>&lt;p&gt;Gary, right, it's better. The only disadvantage of the slash and asterisk commenting style is that it requires more typing than the double hyphen.&lt;/p&gt;

&lt;p&gt;By the way, the stupid &lt;a href="http://michelf.com/projects/php-markdown/extra/" rel="nofollow"&gt;Markdown syntax&lt;/a&gt; ate the asterisks *. Sorry. I used the backslash &#92; to escape it.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Gary, right, it&#8217;s better. The only disadvantage of the slash and asterisk commenting style is that it requires more typing than the double hyphen.</p>
<p>By the way, the stupid <a href="http://michelf.com/projects/php-markdown/extra/" rel="nofollow">Markdown syntax</a> ate the asterisks *. Sorry. I used the backslash &#92; to escape it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
