<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:TimesNewRomanPSMT;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi All,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">From the SQL manual:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-size:12.0pt;font-family:TimesNewRomanPSMT;color:#0070C0">A WHILE statement can be labeled. The label enables the ENDLOOP statement to break out of a<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-size:12.0pt;font-family:TimesNewRomanPSMT;color:#0070C0">nested series of WHILE statements to a specified level. The label precedes WHILE and is<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-size:12.0pt;font-family:TimesNewRomanPSMT;color:#0070C0">specified by a unique alphanumeric identifier followed by a colon, as in the following:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-size:8.5pt;font-family:"Courier New";color:#0070C0">A: WHILE...<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:TimesNewRomanPSMT;color:#0070C0">The label must be a legal object name…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:TimesNewRomanPSMT"><o:p> </o:p></span></p>
<p class="MsoNormal">So why is it that the label can only be a single alphanumeric character? Anything other than a single character causes a syntax error.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Eg: <span style="font-family:"Courier New"">create procedure weird_label<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">as declare<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> loop integer4 not null not default;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> msg varchar(256) not null not default;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">begin<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> loop = 0;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <span style="background:yellow;mso-highlight:yellow">
Outer:</span> while (:loop < 3) do<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> msg = 'Loop ' + varchar(:loop);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> message :msg;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> loop = loop + 1;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> endwhile;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> msg = 'Finished with loop = ' + varchar(:loop);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> message :msg;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">end;</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">E_US09C4 Syntax error on line 4. Last symbol read was: 'Outer'.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Take the above procedure and replace label ‘Outer’ with ‘O’ and it will work.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Martin Bowes<o:p></o:p></p>
</div>
</body>
</html>