<?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: Ultralite cannot execute a select with UNION and null in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/ultralite-cannot-execute-a-select-with-union-and-null/qaa-p/13831780#M4862623</link>
    <description>&lt;P&gt;Hi Breck. No, this isn't a real code, but we are constructing a product that is supposed to work with any type of query (other devs can use our product as a tool).&lt;/P&gt;</description>
    <pubDate>Thu, 02 Aug 2012 15:44:00 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-08-02T15:44:00Z</dc:date>
    <item>
      <title>Ultralite cannot execute a select with UNION and null</title>
      <link>https://community.sap.com/t5/technology-q-a/ultralite-cannot-execute-a-select-with-union-and-null/qaq-p/13831777</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;I've found a possible bug related to Ultralite and &lt;I&gt;SELECT&lt;/I&gt;s commands with &lt;EM&gt;UNION&lt;/EM&gt;.
If I try to execute a select command &lt;EM&gt;union all&lt;/EM&gt; with another select command, and one of these commands have a &lt;EM&gt;null&lt;/EM&gt; column, the Ultralite throws an error, or, in some cases, leaves the ResultSet in a invalid state.
It seems like the Ultralite want to convert the varchar column to numeric so that it can merge the result sets.&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="c1"&gt;-- Error&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;'22222222222222222222222222222'&lt;/SPAN&gt; &lt;SPAN class="k"&gt;as&lt;/SPAN&gt; &lt;SPAN class="n"&gt;c2&lt;/SPAN&gt; &lt;SPAN class="k"&gt;UNION&lt;/SPAN&gt; &lt;SPAN class="k"&gt;ALL&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="k"&gt;null&lt;/SPAN&gt; &lt;SPAN class="k"&gt;as&lt;/SPAN&gt; &lt;SPAN class="n"&gt;c2&lt;/SPAN&gt;

&lt;SPAN class="c1"&gt;-- Invalid State&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="k"&gt;null&lt;/SPAN&gt; &lt;SPAN class="k"&gt;as&lt;/SPAN&gt; &lt;SPAN class="n"&gt;c2&lt;/SPAN&gt; &lt;SPAN class="k"&gt;UNION&lt;/SPAN&gt; &lt;SPAN class="k"&gt;ALL&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;'22222222222222222222222222222'&lt;/SPAN&gt; &lt;SPAN class="k"&gt;as&lt;/SPAN&gt; &lt;SPAN class="n"&gt;c2&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;When an error occurs, the following message is shown:&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="n"&gt;There&lt;/SPAN&gt; &lt;SPAN class="n"&gt;was&lt;/SPAN&gt; &lt;SPAN class="n"&gt;an&lt;/SPAN&gt; &lt;SPAN class="n"&gt;error&lt;/SPAN&gt; &lt;SPAN class="n"&gt;reading&lt;/SPAN&gt; &lt;SPAN class="n"&gt;the&lt;/SPAN&gt; &lt;SPAN class="n"&gt;results&lt;/SPAN&gt; &lt;SPAN class="n"&gt;of&lt;/SPAN&gt; &lt;SPAN class="n"&gt;the&lt;/SPAN&gt; &lt;SPAN class="n"&gt;SQL&lt;/SPAN&gt; &lt;SPAN class="n"&gt;statement&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;The&lt;/SPAN&gt; &lt;SPAN class="n"&gt;displayed&lt;/SPAN&gt; &lt;SPAN class="n"&gt;results&lt;/SPAN&gt; &lt;SPAN class="n"&gt;may&lt;/SPAN&gt; &lt;SPAN class="n"&gt;be&lt;/SPAN&gt; &lt;SPAN class="n"&gt;incorrect&lt;/SPAN&gt; &lt;SPAN class="ow"&gt;or&lt;/SPAN&gt; &lt;SPAN class="n"&gt;incomplete&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="p"&gt;[&lt;/SPAN&gt;&lt;SPAN class="n"&gt;UltraLite&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Database&lt;/SPAN&gt;&lt;SPAN class="p"&gt;]&lt;/SPAN&gt; &lt;SPAN class="n"&gt;Cannot&lt;/SPAN&gt; &lt;SPAN class="n"&gt;convert&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;22222222222222222222222222222&lt;/SPAN&gt; &lt;SPAN class="n"&gt;to&lt;/SPAN&gt; &lt;SPAN class="n"&gt;a&lt;/SPAN&gt; &lt;SPAN class="n"&gt;numeric&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;SQLCODE&lt;/SPAN&gt;&lt;SPAN class="o"&gt;=-&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;157&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt; &lt;SPAN class="n"&gt;ODBC&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;3&lt;/SPAN&gt; &lt;SPAN class="n"&gt;State&lt;/SPAN&gt;&lt;SPAN class="o"&gt;=&lt;/SPAN&gt;&lt;SPAN class="s"&gt;"07006"&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;Best Regards,&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jul 2012 14:07:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ultralite-cannot-execute-a-select-with-union-and-null/qaq-p/13831777</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-07-01T14:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Ultralite cannot execute a select with UNION and null</title>
      <link>https://community.sap.com/t5/technology-q-a/ultralite-cannot-execute-a-select-with-union-and-null/qaa-p/13831779#M4862622</link>
      <description>&lt;P&gt;Is that your real code? Or do you have "UNION ALL SELECT something-else" that happens to be NULL?&lt;/P&gt;
&lt;P&gt;As a workaround, try casting the null: CAST ( NULL AS VARCHAR ( 29 ) )&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jul 2012 16:45:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ultralite-cannot-execute-a-select-with-union-and-null/qaa-p/13831779#M4862622</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2012-07-01T16:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Ultralite cannot execute a select with UNION and null</title>
      <link>https://community.sap.com/t5/technology-q-a/ultralite-cannot-execute-a-select-with-union-and-null/qaa-p/13831778#M4862621</link>
      <description>&lt;P&gt;Thanks for reporting the problem.  It appears that UL doesn't do a good job of inferring the column type when it sees the constant null in the UNION.  I did a little experimentation and it seems that if the null comes from a column (or some expression where the type is better determined) UL does the right thing.&lt;/P&gt;
&lt;P&gt;Breck's workaround is the right one (I confirmed it works with version 12 at least).&lt;/P&gt;
&lt;P&gt;I'll add the issue to our bug list.  In the meantime, hopefully Breck's workaround does the trick for you.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2012 14:09:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ultralite-cannot-execute-a-select-with-union-and-null/qaa-p/13831778#M4862621</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-07-02T14:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Ultralite cannot execute a select with UNION and null</title>
      <link>https://community.sap.com/t5/technology-q-a/ultralite-cannot-execute-a-select-with-union-and-null/qaa-p/13831780#M4862623</link>
      <description>&lt;P&gt;Hi Breck. No, this isn't a real code, but we are constructing a product that is supposed to work with any type of query (other devs can use our product as a tool).&lt;/P&gt;</description>
      <pubDate>Thu, 02 Aug 2012 15:44:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ultralite-cannot-execute-a-select-with-union-and-null/qaa-p/13831780#M4862623</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-08-02T15:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: Ultralite cannot execute a select with UNION and null</title>
      <link>https://community.sap.com/t5/technology-q-a/ultralite-cannot-execute-a-select-with-union-and-null/qaa-p/13831781#M4862624</link>
      <description>&lt;P&gt;Thanks for the replying Paul, but unfortunatelly this workaround doesn't help us so much, because our queries are constructed in runtime. As our product is used as a dev tool, we do not have so much control in which type we should cast to.&lt;/P&gt;
&lt;P&gt;But, I hope the fix for this bug be released soon.
Besides that, I'm going to publish this behavior as a limitation of our product.&lt;/P&gt;
&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Aug 2012 15:50:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ultralite-cannot-execute-a-select-with-union-and-null/qaa-p/13831781#M4862624</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-08-02T15:50:48Z</dc:date>
    </item>
  </channel>
</rss>

