<?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 What&amp;#8217;s in a Label</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/what8217s_in_a_label/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 11 Aug 2008 08:33:41 -0000</lastBuildDate><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658354</link><description>&lt;p&gt;Wow.  I'm moving pl/sql IF statements into the trash bin along side GOTOs, now that I see I can use labeled CASE instead.  (Nested IFs are such a pain to visually decipher.)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Duke Ganote</dc:creator><pubDate>Mon, 11 Aug 2008 08:33:41 -0000</pubDate></item><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658345</link><description>&lt;p&gt;&lt;i&gt;APC: I was merely pointing out that raising an exception is a special case of GOTO.&lt;/i&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Ah! I see. when you raise an exception, you basically "go to" the corresponding exception block.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;i&gt;APC: Before I started in Oracle I worked on a particular flavour of COBOL that didn't support conditional ERFORMs. GOTOs were a way of life.&lt;/i&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;I started my programming career with COBOL, that was in 1992. COBOL and GOTO were best buddies.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;In PL/SQL, I just cannot see a real need to use labels and GOTO's. Labels can be easily replaced with comments. GOTO's can be easily replaced with many other programming controls that provide a much better clarity to the program logic.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eddie Awad</dc:creator><pubDate>Fri, 17 Feb 2006 15:32:42 -0000</pubDate></item><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658353</link><description>&lt;p&gt;Label could be an elegant solution to exit 2 nested loop&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;pre&gt;SQL&amp;gt; Declare&lt;br&gt;  2    LN$I pls_integer := 0 ;&lt;br&gt;  3    LN$J pls_integer := 0 ;&lt;br&gt;  4  Begin&lt;br&gt;  5    &amp;lt;&amp;lt;boucle1&amp;gt;&amp;gt;&lt;br&gt;  6    Loop&lt;br&gt;  7      LN$I := LN$I + 1 ;&lt;br&gt;  8      Loop&lt;br&gt;  9         LN$J := LN$J + 1 ;&lt;br&gt; 10         dbms_output.put_line( to_char( LN$I ) || ',' || to_char( LN$J ) ) ;&lt;br&gt; 11         EXIT boucle1 WHEN LN$J &amp;gt; 3 ;&lt;br&gt; 12      End loop ;&lt;br&gt; 13    End loop ;&lt;br&gt; 14  End ;&lt;br&gt; 15  /&lt;br&gt;1,1&lt;br&gt;1,2&lt;br&gt;1,3&lt;br&gt;1,4&lt;br&gt;&lt;br&gt;ProcÃ©dure PL/SQL terminÃ©e avec succÃ¨s.&lt;br&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">FranÃ§ois Degrelle</dc:creator><pubDate>Fri, 17 Feb 2006 08:14:55 -0000</pubDate></item><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658352</link><description>&lt;p&gt;[OT] &lt;i&gt;I don't think Dijkstra has revoked his fatwa. &lt;/i&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;I don't think he will ever be able to revoke it given that he passed away few years back :(&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Krishna</dc:creator><pubDate>Fri, 17 Feb 2006 07:33:14 -0000</pubDate></item><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658343</link><description>&lt;p&gt;And what's wrong with GOTOs anyway? haven't they been officially considered not harmful for sometime now?&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;They have? Nobody tells me anything.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Actually I was thinking about the NTK newsletter and not some computer science pronouncement.  I don't think Dijkstra has revoked his fatwa.   Still, if you've ever had to follow the possible paths through a function that has over a dozen RETURN statements you might find yourself pining for a nice GOTO exit_point.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;GOTOs are like triggers: there's nothing inherently wrong with the construct, it's simply the potential for abuse that renders their use suspect.  Simply avoiding the use of GOTO statement does not make our code  well-structured.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">APC</dc:creator><pubDate>Fri, 17 Feb 2006 04:45:47 -0000</pubDate></item><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658342</link><description>&lt;p&gt;I take it you use GOTO to raise exceptions&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Of course not.  I was merely pointing out that raising an exception is a special case of GOTO.  Particularly given a case like this:&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;pre&gt;    ....&lt;br&gt;    do_something_a;&lt;br&gt;    do_something_b;&lt;br&gt;EXCEPTION&lt;br&gt;   WHEN others THEN blah;&lt;br&gt;&lt;/pre&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;If do_something_a raises an exception to be handle by the calling program then essentially there is an invisible GOTO that bypasses do_something_b.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Before I started in Oracle I worked on a particular flavour of COBOL that didn't support conditional ERFORMs.  GOTOs were a way of life.  So I know bad use of GOTO create spaghetti code.  I also know that well structured GOTOs have their place.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Of course, Oracle PL/SQL has a panoply of control structures and I have never had to use a GOTO since I stopped COBOLing.  Indeed the other day I found myself with a LOOP that had more than one EXIT statement and felt unclean.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">APC</dc:creator><pubDate>Fri, 17 Feb 2006 04:33:40 -0000</pubDate></item><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658351</link><description>&lt;p&gt;I'm not a developer, but the term GOTO reminds me of writing BASIC on my Commodore 64.  I can't believe it still exists, besides in Windows batch files.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tom_Fox</dc:creator><pubDate>Thu, 16 Feb 2006 15:50:10 -0000</pubDate></item><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658350</link><description>&lt;p&gt;&lt;i&gt;I take it you never raise exceptions either&lt;/i&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;I take it you use GOTO to raise exceptions ;)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eddie Awad</dc:creator><pubDate>Thu, 16 Feb 2006 14:19:42 -0000</pubDate></item><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658349</link><description>&lt;p&gt;&lt;i&gt;&amp;gt; And what's wrong with GOTOs anyway? haven't they been officially considered not harmful for sometime now?&lt;/i&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;They have? Nobody tells me anything.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">William Robertson</dc:creator><pubDate>Thu, 16 Feb 2006 12:42:07 -0000</pubDate></item><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658348</link><description>&lt;p&gt;I don't use GOTOs, but I do use labels for loops sometimes. It's really a clarity thing. If I have nested loops, the labels are handy to see which loop has ended, although a comment would do the same. I also use labels if I'm planning to exit a loop prematurely.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Cheers&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Tim...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tim Hall</dc:creator><pubDate>Thu, 16 Feb 2006 11:23:50 -0000</pubDate></item><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658347</link><description>&lt;p&gt;I use labels in 3 situations: Loops, case statement and begin end block inside a procedure/function. I like that you can end the case or the begin with a label like this:&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;&amp;lt;myBlock&amp;gt;&amp;gt;&lt;br&gt;begin&lt;br&gt;  x := y + 1;&lt;br&gt;end myBlock;&lt;br&gt;&lt;/pre&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;&amp;lt;myCase&amp;gt;&amp;gt;&lt;br&gt;case xx&lt;br&gt;  when ..&lt;br&gt;end case myCase;&lt;br&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Lorenzen</dc:creator><pubDate>Thu, 16 Feb 2006 11:17:34 -0000</pubDate></item><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658346</link><description>&lt;p&gt;Unfortunately there are lots of developers insisting to use goto's. It is a tradition some people cannot give up.&lt;br&gt;It was imposible to get a degree for students using goto's in their assignments in my college years.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">yas</dc:creator><pubDate>Thu, 16 Feb 2006 10:21:45 -0000</pubDate></item><item><title>Re: What&amp;#8217;s in a Label</title><link>http://awads.net/wp/2006/02/16/whats-in-a-label/#comment-3658344</link><description>&lt;p&gt;You missed what I think is a genuine use for labels: identifying nested loops.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;&amp;lt;dept&amp;gt;&amp;gt;&lt;br&gt;FOR d_rec IN ( SELECT deptno FROM scott.dept ) LOOP&lt;br&gt;   do_whatever;&lt;br&gt;   &amp;lt;&amp;lt;emp&amp;gt;&amp;gt;&lt;br&gt;   FOR e_rec IN (SELECT empno FROM scott.emp&lt;br&gt;                          WHERE deptno = d_rec.deptno ) LOOP&lt;br&gt;       blah(e-rec.empno);&lt;br&gt;   END LOOP emp;&lt;br&gt;   clean_up;&lt;br&gt;END LOOP dept;&lt;br&gt;&lt;/pre&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;And what's wrong with GOTOs anyway?  haven't they been officially considered &lt;i&gt;not harmful&lt;/i&gt; for sometime now?  I take it you never raise exceptions either.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Cheers, APC&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">APC</dc:creator><pubDate>Thu, 16 Feb 2006 08:30:11 -0000</pubDate></item></channel></rss>