<?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: Utralite crashes using subquery with CASE in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840142#M4870985</link>
    <description>&lt;P&gt;I can confirm the crash also happens to me using the above query. I'm also using the 3798 EBF, as far as I know it is the latest Ultralite EBF for iOS, or there is any more recent?&lt;/P&gt;</description>
    <pubDate>Tue, 30 Oct 2012 12:51:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-10-30T12:51:16Z</dc:date>
    <item>
      <title>Utralite crashes using subquery with CASE</title>
      <link>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaq-p/13840137</link>
      <description>&lt;P&gt;I have a query that causes a crash in Ultralite, both in the iPad and Interactive SQL. The crash began to happen after I installed EBF 3798. Before that, the query was executed without error. &lt;/P&gt;
&lt;P&gt;The original query is somewhat complex, but I succeeded in devising a simple query that causes the crash as well.&lt;/P&gt;
&lt;P&gt;The query is:&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&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="p"&gt;(&lt;/SPAN&gt;
    &lt;SPAN class="nb"&gt;select&lt;/SPAN&gt; 
    &lt;SPAN class="n"&gt;A&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;id&lt;/SPAN&gt; &lt;SPAN class="n"&gt;as&lt;/SPAN&gt; &lt;SPAN class="n"&gt;i&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;
       &lt;SPAN class="k"&gt;case&lt;/SPAN&gt; &lt;SPAN class="n"&gt;A&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;num&lt;/SPAN&gt; 
            &lt;SPAN class="n"&gt;when&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;0&lt;/SPAN&gt; &lt;SPAN class="k"&gt;then&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'a'&lt;/SPAN&gt;
            &lt;SPAN class="n"&gt;when&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt; &lt;SPAN class="k"&gt;then&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'b'&lt;/SPAN&gt;
            &lt;SPAN class="n"&gt;when&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;2&lt;/SPAN&gt; &lt;SPAN class="k"&gt;then&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'c'&lt;/SPAN&gt;
            &lt;SPAN class="k"&gt;else&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'d'&lt;/SPAN&gt;
       &lt;SPAN class="n"&gt;end&lt;/SPAN&gt; &lt;SPAN class="n"&gt;as&lt;/SPAN&gt; &lt;SPAN class="n"&gt;v&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;
       &lt;SPAN class="n"&gt;v&lt;/SPAN&gt; &lt;SPAN class="o"&gt;+&lt;/SPAN&gt; &lt;SPAN class="s"&gt;' - '&lt;/SPAN&gt; &lt;SPAN class="o"&gt;+&lt;/SPAN&gt; &lt;SPAN class="n"&gt;A&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;num&lt;/SPAN&gt; &lt;SPAN class="n"&gt;as&lt;/SPAN&gt; &lt;SPAN class="n"&gt;s&lt;/SPAN&gt;
    &lt;SPAN class="n"&gt;from&lt;/SPAN&gt; &lt;SPAN class="n"&gt;testTable&lt;/SPAN&gt; &lt;SPAN class="n"&gt;A&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;X&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="n"&gt;i&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt; &lt;SPAN class="n"&gt;v&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt; &lt;SPAN class="n"&gt;s&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;where&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;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;And the Ultralite database has only one table:&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="n"&gt;create&lt;/SPAN&gt; &lt;SPAN class="n"&gt;table&lt;/SPAN&gt; &lt;SPAN class="n"&gt;testTable&lt;/SPAN&gt;
&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;
     &lt;SPAN class="n"&gt;id&lt;/SPAN&gt; &lt;SPAN class="nb"&gt;int&lt;/SPAN&gt; &lt;SPAN class="n"&gt;primary&lt;/SPAN&gt; &lt;SPAN class="n"&gt;key&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;
     &lt;SPAN class="n"&gt;num&lt;/SPAN&gt; &lt;SPAN class="nb"&gt;int&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;
     &lt;SPAN class="n"&gt;descr&lt;/SPAN&gt; &lt;SPAN class="n"&gt;varchar&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;100&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="p"&gt;)&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;The crash occurs when executing ULConnection's PrepareStatement method. And the table does not need to have any data in it.&lt;/P&gt;
&lt;P&gt;If I remove the enclosing select, the problem does not happen again. Also, if remove either column v (the one that contains the case statement) or column s, that concatenates the preceding field with another field from the table, the problem does not occur any longer.&lt;/P&gt;
&lt;P&gt;Those solutions are not acceptable, because the outer query is generated at runtime, in other to add extra filters to an existing query. &lt;/P&gt;</description>
      <pubDate>Mon, 29 Oct 2012 15:39:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaq-p/13840137</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-10-29T15:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Utralite crashes using subquery with CASE</title>
      <link>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840138#M4870981</link>
      <description>&lt;P&gt;That query shouldn't ever work because of the ambiguous use of the "+" operator (is it numeric addition? is it string concatenation?), and it does fail in in SQL Anywhere 12.0.1.3298 Classic (non-UltraLite) as follows:&lt;/P&gt;
&lt;PRE&gt;create table testTable
(
     id int primary key,
     num int,
     descr varchar(100)
);
INSERT testTable VALUES ( 1, 1, 'x' );
COMMIT;
select * from (
    select 
    A.id as i,
       case A.num 
            when 0 then 'a'
            when 1 then 'b'
            when 2 then 'c'
            else 'd'
       end as v,
       v + ' - ' + A.num as s
    from testTable A
) as X(i, v, s)
where i = 1;

There was an error reading the results of the SQL statement.
The displayed results may be incorrect or incomplete.
Cannot convert 'b - ' to a numeric
SQLCODE=-157, ODBC 3 State="07006"
&lt;/PRE&gt;

&lt;P&gt;Try using STRING() instead of "+"; this query works:&lt;/P&gt;
&lt;PRE&gt;select * from (
    select 
    A.id as i,
       case A.num 
            when 0 then 'a'
            when 1 then 'b'
            when 2 then 'c'
            else 'd'
       end as v,
       STRING ( v, ' - ', A.num ) as s
    from testTable A
) as X(i, v, s)
where i = 1;

i,v,s
1,'b','b - 1'
&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Oct 2012 16:48:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840138#M4870981</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2012-10-29T16:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Utralite crashes using subquery with CASE</title>
      <link>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840139#M4870982</link>
      <description>&lt;P&gt;I changed the query to use STRING instead of "+", but it still crashes on iPad and in InteractiveSQL for Mac OS. &lt;/P&gt;
&lt;P&gt;Also, I changed the query to&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&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="p"&gt;(&lt;/SPAN&gt;
&lt;SPAN class="nb"&gt;select&lt;/SPAN&gt; 
   &lt;SPAN class="n"&gt;A&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;id&lt;/SPAN&gt; &lt;SPAN class="n"&gt;as&lt;/SPAN&gt; &lt;SPAN class="n"&gt;i&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;
   &lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="k"&gt;case&lt;/SPAN&gt; &lt;SPAN class="n"&gt;A&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;num&lt;/SPAN&gt; 
        &lt;SPAN class="n"&gt;when&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;0&lt;/SPAN&gt; &lt;SPAN class="k"&gt;then&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'a'&lt;/SPAN&gt;
        &lt;SPAN class="n"&gt;when&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;1&lt;/SPAN&gt; &lt;SPAN class="k"&gt;then&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'b'&lt;/SPAN&gt;
        &lt;SPAN class="n"&gt;when&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;2&lt;/SPAN&gt; &lt;SPAN class="k"&gt;then&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'c'&lt;/SPAN&gt;
        &lt;SPAN class="k"&gt;else&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'d'&lt;/SPAN&gt;
   &lt;SPAN class="n"&gt;end&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;v&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt;
   &lt;SPAN class="n"&gt;v&lt;/SPAN&gt; &lt;SPAN class="o"&gt;+&lt;/SPAN&gt; &lt;SPAN class="s"&gt;' - '&lt;/SPAN&gt; &lt;SPAN class="o"&gt;+&lt;/SPAN&gt; &lt;SPAN class="n"&gt;A&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;descr&lt;/SPAN&gt; &lt;SPAN class="n"&gt;as&lt;/SPAN&gt; &lt;SPAN class="n"&gt;s&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;from&lt;/SPAN&gt; &lt;SPAN class="n"&gt;testTable&lt;/SPAN&gt; &lt;SPAN class="n"&gt;A&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;X&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="n"&gt;i&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt; &lt;SPAN class="n"&gt;v&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt; &lt;SPAN class="n"&gt;s&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;where i = 1&lt;/P&gt;
&lt;P&gt;The crash always happens, and the first time when there was an ambiguity, Ultralite did not return any error. It simply crashes.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Oct 2012 17:21:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840139#M4870982</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-10-29T17:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: Utralite crashes using subquery with CASE</title>
      <link>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840140#M4870983</link>
      <description>&lt;P&gt;I believe this is an instance of &lt;A href="http://search.sybase.com/kbx/changerequests?bug_id=717377"&gt;CR #717377&lt;/A&gt; fixed in 12.0.1.3803.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Oct 2012 17:56:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840140#M4870983</guid>
      <dc:creator>jeff_albion</dc:creator>
      <dc:date>2012-10-29T17:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Utralite crashes using subquery with CASE</title>
      <link>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840142#M4870985</link>
      <description>&lt;P&gt;I can confirm the crash also happens to me using the above query. I'm also using the 3798 EBF, as far as I know it is the latest Ultralite EBF for iOS, or there is any more recent?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2012 12:51:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840142#M4870985</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-10-30T12:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Utralite crashes using subquery with CASE</title>
      <link>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840143#M4870986</link>
      <description>&lt;P&gt;I haven't found this version in the EBF list. Is it available for download? If not, when will it be?&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2012 17:48:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840143#M4870986</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-10-30T17:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Utralite crashes using subquery with CASE</title>
      <link>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840141#M4870984</link>
      <description>&lt;P&gt;Hi Antonio,&lt;/P&gt;
&lt;P&gt;Thank you for posting this concise repro. I confirm that the crash was fixed in 12.0.1.3803. There was a further bug that your query exposed, and that is now fixed with 12.0.1.3812. I have requested an EBF be released.&lt;/P&gt;
&lt;P&gt;And thank you Breck for correcting the query. Indeed, UL does (now) report -157 (conversion error) for 'b -' -&amp;gt; numeric with the original query.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2012 13:33:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840141#M4870984</guid>
      <dc:creator>former_SQLA_member1694876</dc:creator>
      <dc:date>2012-11-01T13:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Utralite crashes using subquery with CASE</title>
      <link>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840144#M4870987</link>
      <description>&lt;P&gt;Hi Tim,&lt;/P&gt;
&lt;P&gt;Do you have any news about the EBF?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2012 09:24:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840144#M4870987</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-11-13T09:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Utralite crashes using subquery with CASE</title>
      <link>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840145#M4870988</link>
      <description>&lt;P&gt;Hello Antonio,&lt;/P&gt;
&lt;P&gt;This issue has been reported and fixed underneath &lt;A href="http://search.sybase.com/kbx/changerequests?bug_id=723102"&gt;CR #723102&lt;/A&gt;. The Windows / Mac OS 12.0.1 EBFs have been requested for this issue and are currently being built and tested internally.&lt;/P&gt;
&lt;P&gt;If you require an immediate update for when the EBF is released (or a "pre-release" copy for your own testing purposes), we invite you to open a &lt;A href="http://www.sybase.com/contactus/support/"&gt;technical support case&lt;/A&gt; so that we can discuss this with you directly and properly address your individual business needs.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2012 15:13:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840145#M4870988</guid>
      <dc:creator>jeff_albion</dc:creator>
      <dc:date>2012-11-13T15:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Utralite crashes using subquery with CASE</title>
      <link>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840146#M4870989</link>
      <description>&lt;P&gt;This should be posted now (build 3819), and also includes proper iPhone 5/Xcode 4.5 support.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2012 13:30:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/utralite-crashes-using-subquery-with-case/qaa-p/13840146#M4870989</guid>
      <dc:creator>former_SQLA_member1694876</dc:creator>
      <dc:date>2012-12-12T13:30:09Z</dc:date>
    </item>
  </channel>
</rss>

