<?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: While Statement in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820944#M4851787</link>
    <description>&lt;P&gt;Just to add: Watcom-SQL is the name of SQL Anywhere's native SQL dialect, so unless otherwise noted, all documented SQL statements belong to this dialect.&lt;/P&gt;
&lt;P&gt;In contrast, SQL Anywhere also supports a subset of the Transact-SQL dialect (T-SQL), as used by ASE and MS SQL Server. Those statements are generally marked as such, see Chris's comment.&lt;/P&gt;
&lt;P&gt;And while (pun intended) you can use both dialects in the same database connection, you &lt;EM&gt;cannot&lt;/EM&gt; do so within one SQL code block, such as a stored procedure.&lt;/P&gt;</description>
    <pubDate>Sat, 16 May 2020 06:44:00 GMT</pubDate>
    <dc:creator>VolkerBarth</dc:creator>
    <dc:date>2020-05-16T06:44:00Z</dc:date>
    <item>
      <title>While Statement</title>
      <link>https://community.sap.com/t5/technology-q-a/while-statement/qaq-p/13820935</link>
      <description>&lt;P&gt;Why I can't write an &lt;STRONG&gt;IF STATEMENT&lt;/STRONG&gt; / &lt;STRONG&gt;TRIGGER EVENT STATEMENT&lt;/STRONG&gt; within a &lt;STRONG&gt;WHILE LOOP&lt;/STRONG&gt;?&lt;/P&gt;
&lt;P&gt;My Script looks like this:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;while (1=1)&lt;/P&gt;
&lt;P&gt;begin&lt;/P&gt;
&lt;P&gt;trigger event MYEVENT;&lt;/P&gt;
&lt;P&gt;waitfor delay 50;&lt;/P&gt;
&lt;P&gt;load into table TABLE1 from 'C:\\Temp\\2020.CSV' DELIMITED BY ';' quote '"' skip 1&lt;/P&gt;
&lt;P&gt;if exists (select * from TABLE1 except select * from TABLE2) then&lt;/P&gt;
&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;&lt;/SPAN&gt;  insert into exporterrorlogs (exportstatus) values ('NOK');
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;else&lt;/P&gt;
&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;&lt;/SPAN&gt;  insert into exporterrorlogs (exportstatus) values ('OK');
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;end if;&lt;/P&gt;
&lt;P&gt;end&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The same applies if I try to use LOOP statement instead of WHILE END.&lt;/P&gt;
&lt;P&gt;Which alternative do I have in order to write a conditional statement within an endless loop?&lt;/P&gt;
&lt;P&gt;Any Ideas? Thanks in advance&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 07:10:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/while-statement/qaq-p/13820935</guid>
      <dc:creator>Baron</dc:creator>
      <dc:date>2020-05-15T07:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: While Statement</title>
      <link>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820936#M4851779</link>
      <description>&lt;PRE&gt;WHILE you are mixing Watcom-SQL and Transact-SQL syntax LOOP
   errors may show up;
END LOOP;
&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 May 2020 07:17:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820936#M4851779</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2020-05-15T07:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: While Statement</title>
      <link>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820937#M4851780</link>
      <description>&lt;P&gt;But is there a way to realize this bulk of watcom-sql statements in an endless loop without doing this mixing?&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 07:27:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820937#M4851780</guid>
      <dc:creator>Baron</dc:creator>
      <dc:date>2020-05-15T07:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: While Statement</title>
      <link>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820938#M4851781</link>
      <description>&lt;P&gt;Have you tried to use the Watcom-SQL WHILE/LOOP/END LOOP syntax? - For an overview, see &lt;A href="http://dcx.sap.com/index.html#sqla170/en/html/3bec29c76c5f1014a91fa4cd3ffedef7.html"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Aside: You have not told what the error is, so I don't know whether this is due to dialects  - but mixing both dialects surely &lt;EM&gt;is&lt;/EM&gt; error-prone and sometimes leads to rather meaningless resp. irritating error messages.&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 08:16:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820938#M4851781</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2020-05-15T08:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: While Statement</title>
      <link>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820939#M4851782</link>
      <description>&lt;P&gt;LOL! ...very funny &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 08:22:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820939#M4851782</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2020-05-15T08:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: While Statement</title>
      <link>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820940#M4851783</link>
      <description>&lt;P&gt;The error is syntax error&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 18:35:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820940#M4851783</guid>
      <dc:creator>Baron</dc:creator>
      <dc:date>2020-05-15T18:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: While Statement</title>
      <link>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820941#M4851784</link>
      <description>&lt;P&gt;but how can I distinguish between those 2 dialects (watcom / Transact)?&lt;/P&gt;
&lt;P&gt;Why I cant find the "&lt;STRONG&gt;Watcom-SQL WHILE/LOOP/END Loop Syntax&lt;/STRONG&gt;" in the PDF documentation of &lt;STRONG&gt;SQL Anywhere Server SQL Anywhere - SQL Reference&lt;/STRONG&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 18:52:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820941#M4851784</guid>
      <dc:creator>Baron</dc:creator>
      <dc:date>2020-05-15T18:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: While Statement</title>
      <link>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820942#M4851785</link>
      <description>&lt;P&gt;See &lt;A href="http://dcx.sap.com/index.html#sqla170/en/html/3bec29c76c5f1014a91fa4cd3ffedef7.html*loio3bec29c76c5f1014a91fa4cd3ffedef7"&gt;http://dcx.sap.com/index.html#sqla170/en/html/3bec29c76c5f1014a91fa4cd3ffedef7.html*loio3bec29c76c5f1014a91fa4cd3ffedef7&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The issue is that Watcom dialect, WHILE is a clause of the LOOP statement. &lt;/P&gt;
&lt;P&gt;If a statement is TSQL, it is identified as such.  See &lt;A href="http://dcx.sap.com/index.html#sqla170/en/html/817adec96ce21014abeedc732b220dbe.html"&gt;http://dcx.sap.com/index.html#sqla170/en/html/817adec96ce21014abeedc732b220dbe.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In the case of the WHILE statement that you used, the statement is titled as WHILE statement [T-SQL].&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 22:35:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820942#M4851785</guid>
      <dc:creator>chris_keating</dc:creator>
      <dc:date>2020-05-15T22:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: While Statement</title>
      <link>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820943#M4851786</link>
      <description>&lt;P&gt;3 downvotes? Why?&lt;/P&gt;</description>
      <pubDate>Sat, 16 May 2020 06:17:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820943#M4851786</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2020-05-16T06:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: While Statement</title>
      <link>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820944#M4851787</link>
      <description>&lt;P&gt;Just to add: Watcom-SQL is the name of SQL Anywhere's native SQL dialect, so unless otherwise noted, all documented SQL statements belong to this dialect.&lt;/P&gt;
&lt;P&gt;In contrast, SQL Anywhere also supports a subset of the Transact-SQL dialect (T-SQL), as used by ASE and MS SQL Server. Those statements are generally marked as such, see Chris's comment.&lt;/P&gt;
&lt;P&gt;And while (pun intended) you can use both dialects in the same database connection, you &lt;EM&gt;cannot&lt;/EM&gt; do so within one SQL code block, such as a stored procedure.&lt;/P&gt;</description>
      <pubDate>Sat, 16 May 2020 06:44:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/while-statement/qaa-p/13820944#M4851787</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2020-05-16T06:44:00Z</dc:date>
    </item>
  </channel>
</rss>

