<?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 Beware of Comments in SQL</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/beware_of_comments_in_sql/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 15 Oct 2007 15:53:33 -0000</lastBuildDate><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659351</link><description>&lt;p&gt;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.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eddie Awad</dc:creator><pubDate>Mon, 15 Oct 2007 15:53:33 -0000</pubDate></item><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659350</link><description>&lt;p&gt;and what about this :)&lt;/p&gt;&lt;p&gt;&lt;a href="http://coskan.wordpress.com/2007/04/23/oracle-idiosyncrasies-2/" rel="nofollow noopener" target="_blank" title="http://coskan.wordpress.com/2007/04/23/oracle-idiosyncrasies-2/"&gt;http://coskan.wordpress.com...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">coskan</dc:creator><pubDate>Mon, 15 Oct 2007 07:58:37 -0000</pubDate></item><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659353</link><description>&lt;p&gt;...only with the line breaks I posted left in...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">William Robertson</dc:creator><pubDate>Wed, 10 Oct 2007 19:30:27 -0000</pubDate></item><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659359</link><description>&lt;p&gt;Well, duh ;)&lt;/p&gt;&lt;p&gt;&lt;br&gt;&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;&lt;br&gt;&lt;/p&gt;&lt;p&gt;EXECUTE IMMEDIATE&lt;br&gt;    'SELECT --+ FULL(e) ' ||&lt;br&gt;    '       COUNT(*) ' ||&lt;br&gt;    'FROM   emp e ' ||&lt;br&gt;    'WHERE  e.empno = 42' INTO v;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">William Robertson</dc:creator><pubDate>Wed, 10 Oct 2007 19:29:22 -0000</pubDate></item><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659361</link><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;&lt;br&gt;&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;&lt;br&gt;&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;&lt;br&gt;&lt;/p&gt;&lt;p&gt;The second situation is, well, rather simple. For example:&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;pre&gt;&lt;code&gt;SQL&amp;gt; select * from dual;&lt;br&gt;&lt;br&gt;D&lt;br&gt;-&lt;br&gt;X&lt;br&gt;&lt;br&gt;SQL&amp;gt; select * -- comment here from dual;&lt;br&gt;select * -- comment here from dual&lt;br&gt;                                 *&lt;br&gt;ERROR at line 1:&lt;br&gt;ORA-00923: FROM keyword not found where expected&lt;br&gt;&lt;br&gt;&lt;br&gt;SQL&amp;gt; select * /* comment here */ from dual;&lt;br&gt;&lt;br&gt;D&lt;br&gt;-&lt;br&gt;X&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;br&gt;&lt;/p&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 noopener" target="_blank" title="http://pbarut.blogspot.com/2007/10/comments-in-sqlplus.html"&gt;comments in SQL*Plus&lt;/a&gt;.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eddie Awad</dc:creator><pubDate>Wed, 10 Oct 2007 18:43:33 -0000</pubDate></item><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659362</link><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><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">William Robertson</dc:creator><pubDate>Wed, 10 Oct 2007 18:10:27 -0000</pubDate></item><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659352</link><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><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eddie Awad</dc:creator><pubDate>Wed, 10 Oct 2007 11:14:29 -0000</pubDate></item><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659360</link><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><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt</dc:creator><pubDate>Wed, 10 Oct 2007 10:14:34 -0000</pubDate></item><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659358</link><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;&lt;br&gt;&lt;/p&gt;&lt;p&gt;By the way, the stupid &lt;a href="http://michelf.com/projects/php-markdown/extra/" rel="nofollow noopener" target="_blank" title="http://michelf.com/projects/php-markdown/extra/"&gt;Markdown syntax&lt;/a&gt; ate the asterisks *. Sorry. I used the backslash \ to escape it.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eddie Awad</dc:creator><pubDate>Tue, 09 Oct 2007 18:30:53 -0000</pubDate></item><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659357</link><description>&lt;p&gt;[That looks odd - looks like it did something to the asterisks - try again /../]&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gary</dc:creator><pubDate>Tue, 09 Oct 2007 18:18:57 -0000</pubDate></item><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659356</link><description>&lt;p&gt;The /.../ style comments are much better if you ever have to dig SQL out of the V$SQL views&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gary</dc:creator><pubDate>Tue, 09 Oct 2007 18:17:39 -0000</pubDate></item><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659355</link><description>&lt;p&gt;I do not know if this applies to all versions. We have Oracle Forms version 6, EBS 11.5.10 and a 10gR1 database.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eddie Awad</dc:creator><pubDate>Tue, 09 Oct 2007 13:25:55 -0000</pubDate></item><item><title>Re: Beware of Comments in SQL</title><link>http://awads.net/wp/2007/10/09/beware-of-comments-in-sql/#comment-3659354</link><description>&lt;p&gt;That seems so stupid from Oracle, Eddie.&lt;br&gt;Does this apply to all versions?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Guest</dc:creator><pubDate>Tue, 09 Oct 2007 13:02:11 -0000</pubDate></item></channel></rss>