<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: loop error,pls in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825965#M4856808</link>
    <description>&lt;P&gt;WATCOM SQL
 so I should go to where to find relevant learning materials&lt;/P&gt;</description>
    <pubDate>Fri, 04 Oct 2013 13:48:35 GMT</pubDate>
    <dc:creator>ximen</dc:creator>
    <dc:date>2013-10-04T13:48:35Z</dc:date>
    <item>
      <title>loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaq-p/13825958</link>
      <description>&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="n"&gt;declare&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@product_code&lt;/SPAN&gt; &lt;SPAN class="n"&gt;char&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;10&lt;/SPAN&gt;&lt;SPAN class="p"&gt;),&lt;/SPAN&gt;&lt;SPAN class="nv"&gt;@rowNR&lt;/SPAN&gt; &lt;SPAN class="nb"&gt;int&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="nv"&gt;@Mrow&lt;/SPAN&gt; &lt;SPAN class="nb"&gt;int&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;set&lt;/SPAN&gt;     &lt;SPAN class="n"&gt;i&lt;/SPAN&gt;&lt;SPAN class="o"&gt;=&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;
&lt;SPAN class="nb"&gt;select&lt;/SPAN&gt; &lt;SPAN class="n"&gt;product_code&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="n"&gt;row_number&lt;/SPAN&gt;&lt;SPAN class="p"&gt;()&lt;/SPAN&gt; &lt;SPAN class="n"&gt;over&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="n"&gt;order&lt;/SPAN&gt; &lt;SPAN class="n"&gt;by&lt;/SPAN&gt; &lt;SPAN class="n"&gt;parent_id&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt; &lt;SPAN class="n"&gt;as&lt;/SPAN&gt; &lt;SPAN class="n"&gt;rowNR&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="n"&gt;parent_id&lt;/SPAN&gt; &lt;SPAN class="n"&gt;into&lt;/SPAN&gt; &lt;SPAN class="c1"&gt;#FT_1 from product_code where parent_id='cp'&lt;/SPAN&gt;
&lt;SPAN class="sr"&gt;//s&lt;/SPAN&gt;&lt;SPAN class="n"&gt;elect&lt;/SPAN&gt; &lt;SPAN class="o"&gt;*&lt;/SPAN&gt; &lt;SPAN class="n"&gt;from&lt;/SPAN&gt; &lt;SPAN class="c1"&gt;#ft_1&lt;/SPAN&gt;
&lt;SPAN class="sr"&gt;//s&lt;/SPAN&gt;&lt;SPAN class="n"&gt;elect&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@mrow&lt;/SPAN&gt;&lt;SPAN class="o"&gt;=&lt;/SPAN&gt;&lt;SPAN class="n"&gt;max&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="n"&gt;rowNR&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt; &lt;SPAN class="n"&gt;from&lt;/SPAN&gt; &lt;SPAN class="c1"&gt;#ft_1 &lt;/SPAN&gt;
&lt;SPAN class="sr"&gt;//s&lt;/SPAN&gt;&lt;SPAN class="n"&gt;elect&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@mrow&lt;/SPAN&gt;      
&lt;SPAN class="k"&gt;while&lt;/SPAN&gt;  &lt;SPAN class="n"&gt;i&lt;/SPAN&gt;&lt;SPAN class="o"&gt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;29&lt;/SPAN&gt; &lt;SPAN class="n"&gt;LOOP&lt;/SPAN&gt;
    &lt;SPAN class="nb"&gt;select&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@product_code&lt;/SPAN&gt;&lt;SPAN class="o"&gt;=&lt;/SPAN&gt;&lt;SPAN class="n"&gt;product_code&lt;/SPAN&gt; &lt;SPAN class="n"&gt;from&lt;/SPAN&gt; &lt;SPAN class="c1"&gt;#ft_1 where i=rownr&lt;/SPAN&gt;
&lt;SPAN class="nb"&gt;select&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@product_code&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;set&lt;/SPAN&gt; &lt;SPAN class="n"&gt;i&lt;/SPAN&gt;&lt;SPAN class="o"&gt;=&lt;/SPAN&gt;&lt;SPAN class="n"&gt;i&lt;/SPAN&gt;&lt;SPAN class="o"&gt;+&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;end&lt;/SPAN&gt; &lt;SPAN class="n"&gt;loop&lt;/SPAN&gt;

&lt;SPAN class="nb"&gt;select&lt;/SPAN&gt; &lt;SPAN class="o"&gt;*&lt;/SPAN&gt; &lt;SPAN class="n"&gt;from&lt;/SPAN&gt; &lt;SPAN class="c1"&gt;#t1&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;error   loop
&lt;IMG alt="alt text" src="http://itpubpic.img168.net/forum/201310/05/004931uffwgzp7mogcffmg.jpg" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 12:03:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaq-p/13825958</guid>
      <dc:creator>ximen</dc:creator>
      <dc:date>2013-10-04T12:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825962#M4856805</link>
      <description>&lt;P&gt;What do you expect anyone to do now? - Your &lt;DEL&gt;questions&lt;/DEL&gt; incomplete postings are really becoming a nuisance here, at least in my usually humble opinion:(&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 12:27:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825962#M4856805</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2013-10-04T12:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825959#M4856802</link>
      <description>&lt;P&gt;Please post proper questions. If you don't know how to phrase them in English, just write them in your own language. &lt;/P&gt;
&lt;P&gt;I fear you mis-understand the purposes of groups like these - they aren't here to do your work for you. If you have something you can't make work - explain what the problem is, what you have tried to do to solve it yourself, exactly what error you are getting and when, together with the version of the software, OS etc that you are using.&lt;/P&gt;
&lt;P&gt;If you just post some code and say "error loop" - you are expecting someone else to set up a test environment, run your code etc just to find out what the problem is - not many people have the time or inclination to do that. You may do better to employ a consultant with the appropriate skills or use SAP's consulting services.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 12:44:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825959#M4856802</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2013-10-04T12:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825963#M4856806</link>
      <description>&lt;P&gt;Please help me to correction  ,I uploaded the pictures of the error  thanks,So I'll pay attention next time under my ability of expression&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 12:51:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825963#M4856806</guid>
      <dc:creator>ximen</dc:creator>
      <dc:date>2013-10-04T12:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825964#M4856807</link>
      <description>&lt;P&gt;Please help me to correction ,I uploaded the pictures of the error thanks,So I'll pay attention next time under my ability of expression&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 12:51:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825964#M4856807</guid>
      <dc:creator>ximen</dc:creator>
      <dc:date>2013-10-04T12:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825960#M4856803</link>
      <description>&lt;P&gt;I think the problem that you are having is that you are mixing WATCOM SQL with TSQL. The &lt;A href="http://dcx.sybase.com/index.html#sa160/en/dbreference/loop-statement.html*d5e61152"&gt;WHILE ... LOOP statement&lt;/A&gt; is WATCOM SQL whereas the &lt;A href="http://dcx.sybase.com/index.html#sa160/en/dbreference/while-statement.html"&gt;TSQL variant of a WHILE statement&lt;/A&gt; does not use the LOOP keyword.  You have been using TSQL procedures so you need to use a WHILE statement - i.e. remove the LOOP and END LOOP and add in a BEGIN ... END.&lt;/P&gt;
&lt;P&gt;OR alternatively, switch to using WATCOM SQL.&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 13:07:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825960#M4856803</guid>
      <dc:creator>MarkCulp</dc:creator>
      <dc:date>2013-10-04T13:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825961#M4856804</link>
      <description>&lt;P&gt;You have a syntax error because you are running a series statements without any separators. You need a semi-colon between separate statements eg:&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="n"&gt;declare&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@product_code&lt;/SPAN&gt; &lt;SPAN class="n"&gt;char&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;10&lt;/SPAN&gt;&lt;SPAN class="p"&gt;),&lt;/SPAN&gt;&lt;SPAN class="nv"&gt;@rowNR&lt;/SPAN&gt; &lt;SPAN class="nb"&gt;int&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="nv"&gt;@Mrow&lt;/SPAN&gt; &lt;SPAN class="nb"&gt;int&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;set&lt;/SPAN&gt;     &lt;SPAN class="n"&gt;i&lt;/SPAN&gt;&lt;SPAN class="o"&gt;=&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="nb"&gt;select&lt;/SPAN&gt; &lt;SPAN class="n"&gt;product_code&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="n"&gt;row_number&lt;/SPAN&gt;&lt;SPAN class="p"&gt;()&lt;/SPAN&gt; &lt;SPAN class="n"&gt;over&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="n"&gt;order&lt;/SPAN&gt; &lt;SPAN class="n"&gt;by&lt;/SPAN&gt; &lt;SPAN class="n"&gt;parent_id&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt; &lt;SPAN class="n"&gt;as&lt;/SPAN&gt; &lt;SPAN class="n"&gt;rowNR&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;&lt;SPAN class="n"&gt;parent_id&lt;/SPAN&gt; &lt;SPAN class="n"&gt;into&lt;/SPAN&gt; &lt;SPAN class="c1"&gt;#FT_1 from      product_code where parent_id='cp';&lt;/SPAN&gt;
&lt;SPAN class="sr"&gt;//s&lt;/SPAN&gt;&lt;SPAN class="n"&gt;elect&lt;/SPAN&gt; &lt;SPAN class="o"&gt;*&lt;/SPAN&gt; &lt;SPAN class="n"&gt;from&lt;/SPAN&gt; &lt;SPAN class="c1"&gt;#ft_1&lt;/SPAN&gt;
&lt;SPAN class="sr"&gt;//s&lt;/SPAN&gt;&lt;SPAN class="n"&gt;elect&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@mrow&lt;/SPAN&gt;&lt;SPAN class="o"&gt;=&lt;/SPAN&gt;&lt;SPAN class="n"&gt;max&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="n"&gt;rowNR&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt; &lt;SPAN class="n"&gt;from&lt;/SPAN&gt; &lt;SPAN class="c1"&gt;#ft_1 &lt;/SPAN&gt;
&lt;SPAN class="sr"&gt;//s&lt;/SPAN&gt;&lt;SPAN class="n"&gt;elect&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@mrow&lt;/SPAN&gt;      
&lt;SPAN class="k"&gt;while&lt;/SPAN&gt;  &lt;SPAN class="n"&gt;i&lt;/SPAN&gt;&lt;SPAN class="o"&gt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;29&lt;/SPAN&gt; &lt;SPAN class="n"&gt;LOOP&lt;/SPAN&gt;
&lt;SPAN class="nb"&gt;select&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@product_code&lt;/SPAN&gt;&lt;SPAN class="o"&gt;=&lt;/SPAN&gt;&lt;SPAN class="n"&gt;product_code&lt;/SPAN&gt; &lt;SPAN class="n"&gt;from&lt;/SPAN&gt; &lt;SPAN class="c1"&gt;#ft_1 where i=rownr;&lt;/SPAN&gt;
&lt;SPAN class="nb"&gt;select&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@product_code&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;set&lt;/SPAN&gt; &lt;SPAN class="n"&gt;i&lt;/SPAN&gt;&lt;SPAN class="o"&gt;=&lt;/SPAN&gt;&lt;SPAN class="n"&gt;i&lt;/SPAN&gt;&lt;SPAN class="o"&gt;+&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;1&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;end&lt;/SPAN&gt; &lt;SPAN class="n"&gt;loop&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;also you haven't declared i&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 13:12:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825961#M4856804</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2013-10-04T13:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825965#M4856808</link>
      <description>&lt;P&gt;WATCOM SQL
 so I should go to where to find relevant learning materials&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 13:48:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825965#M4856808</guid>
      <dc:creator>ximen</dc:creator>
      <dc:date>2013-10-04T13:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825966#M4856809</link>
      <description>&lt;P&gt;Unable to execute the statement   stop i is not var&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 13:49:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825966#M4856809</guid>
      <dc:creator>ximen</dc:creator>
      <dc:date>2013-10-04T13:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825967#M4856810</link>
      <description>&lt;P&gt;My answer contains the two relevant links for the two variants of the WHILE statement.  You can find all of the documentation for SQL Anywhere at &lt;A href="http://dcx.sybase.com/index.html"&gt;http://dcx.sybase.com/index.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 13:51:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825967#M4856810</guid>
      <dc:creator>MarkCulp</dc:creator>
      <dc:date>2013-10-04T13:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825968#M4856811</link>
      <description>&lt;P&gt;as I said, you need to declare i before you can use it.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 16:38:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825968#M4856811</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2013-10-04T16:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825969#M4856812</link>
      <description>&lt;LI-CODE lang="sql"&gt;declare @product_code char(10),@rowNR int,@Mrow int
declare i
set  i=1
select product_code,row_number() over(order by parent_id) as rowNR,parent_id into #FT_1 from      product_code where parent_id='cp'
//select * from #ft_1
//select @mrow=max(rowNR) from #ft_1 
//select @mrow      
while  i&amp;lt;=29 LOOP
select @product_code=product_code from #ft_1 where i=rownr;
select @product_code;
set i=i+1;
end loop
&lt;/LI-CODE&gt;

&lt;P&gt;error for set i=1&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 07:17:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825969#M4856812</guid>
      <dc:creator>ximen</dc:creator>
      <dc:date>2013-10-10T07:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825970#M4856813</link>
      <description>&lt;P&gt;(a) Your "declare i" is an incomplete statement - it needs a type. You likely want "declare i int"&lt;/P&gt;
&lt;P&gt;(b) Did you read Justin's and my answer? You are mixing WATCOM SQL with TSQL and therefore you need to pick one. You are not going to anywhere with fixing your problems if you don't.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 08:13:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825970#M4856813</guid>
      <dc:creator>MarkCulp</dc:creator>
      <dc:date>2013-10-10T08:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: loop error,pls</title>
      <link>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825971#M4856814</link>
      <description>&lt;P&gt;&lt;A href="https://sqlanywhere-forum.sap.com/users/1128/mfkpie8/"&gt;@mfkpie8&lt;/A&gt;: Have you read the answers by Justin and Mark? They clearly explain the problem (mixing T-SQL and Watcom-SQL syntax). And you are still mixing these dialects. Sigh.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2013 08:14:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/loop-error-pls/qaa-p/13825971#M4856814</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2013-10-10T08:14:00Z</dc:date>
    </item>
  </channel>
</rss>

