<?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: SQL Statement too long in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/sql-statement-too-long/qaa-p/12496790#M4682848</link>
    <description>&lt;P&gt;It would help to better understand what you are trying to achieve with this query. &lt;/P&gt;&lt;P&gt;It seems like you are aggregating a sum of a product (*) of the same one value from `SELECT A FROM "HANA_XS_BASE"."test_file" LIMIT 1 OFFSET 0` with some numbers? Where are these numbers coming from?&lt;/P&gt;</description>
    <pubDate>Mon, 28 Mar 2022 19:41:20 GMT</pubDate>
    <dc:creator>Vitaliy-R</dc:creator>
    <dc:date>2022-03-28T19:41:20Z</dc:date>
    <item>
      <title>SQL Statement too long</title>
      <link>https://community.sap.com/t5/technology-q-a/sql-statement-too-long/qaq-p/12496789</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
  &lt;P&gt;I have googled all day long and also tried some attempts from this forum without any success. I want to run a SQL Query inside my HANA Express edition. My query has a total of 30 Million characters and about 401k subquerries.&lt;/P&gt;
  &lt;P&gt;The goal is to run through each and every cell of a db and calculate a value out of it. &lt;/P&gt;
  &lt;P&gt;The query looks like this:&lt;/P&gt;
  &lt;P&gt;SELECT(...(SELECT A FROM "HANA_XS_BASE"."test_file" LIMIT 1 OFFSET 0)*(-0.041558202)+(SELECT B FROM "HANA_XS_BASE"."test_file" LIMIT 1 OFFSET 0)*(0.05298289)+...&lt;/P&gt;
  &lt;P&gt;I already know that it works, when I run only the first line of code.&lt;/P&gt;
  &lt;P&gt;HANA only allows queries with up to 16 million characters. Maybe someone here has a good idea how I could run the whole query. Or maybe even a better way to build the statement ? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
  &lt;P&gt;So far I have tried to create a variable for big pieces or just small ones like "HANA_XS_BASE"."test_file" (which is always the same) to replace a huge amount of characters with a variable. Apparently that didn't work, maybe because I am not too familiar with variables in SQL ^^ &lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 15:42:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sql-statement-too-long/qaq-p/12496789</guid>
      <dc:creator>raffaelw8</dc:creator>
      <dc:date>2022-03-28T15:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Statement too long</title>
      <link>https://community.sap.com/t5/technology-q-a/sql-statement-too-long/qaa-p/12496790#M4682848</link>
      <description>&lt;P&gt;It would help to better understand what you are trying to achieve with this query. &lt;/P&gt;&lt;P&gt;It seems like you are aggregating a sum of a product (*) of the same one value from `SELECT A FROM "HANA_XS_BASE"."test_file" LIMIT 1 OFFSET 0` with some numbers? Where are these numbers coming from?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 19:41:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sql-statement-too-long/qaa-p/12496790#M4682848</guid>
      <dc:creator>Vitaliy-R</dc:creator>
      <dc:date>2022-03-28T19:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Statement too long</title>
      <link>https://community.sap.com/t5/technology-q-a/sql-statement-too-long/qaa-p/12496791#M4682849</link>
      <description>&lt;P&gt;Hi Witalij,&lt;/P&gt;&lt;P&gt;you are right. My starting point is a calculation of sum and products. It calculates a value out of the cells of a db. My goal is to let HANA calculate this for me via a SQL query. The decimal numbers that I am multiplying are generated by another code. The values inside the cells are also decimal numbers.&lt;/P&gt;&lt;P&gt;For example, if I have a db with the titles A, B, C, ... and rows 1, 2, 3, 4, ...&lt;/P&gt;&lt;P&gt;The function&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(...(&lt;STRONG&gt;A1&lt;/STRONG&gt;)*(-0.041558202)+(&lt;STRONG&gt;B1&lt;/STRONG&gt;)*(0.05298289)+...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;would be changed into&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SELECT(...(&lt;STRONG&gt;SELECT A FROM "HANA_XS_BASE"."test_file" LIMIT 1 OFFSET 0&lt;/STRONG&gt;)*(-0.041558202)+(&lt;STRONG&gt;SELECT B FROM "HANA_XS_BASE"."test_file" LIMIT 1 OFFSET 0&lt;/STRONG&gt;)*(0.05298289)+...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;It's just about a mathematical function that needs to be calculated by HANA and the function is filled with values out of a db &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 06:22:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sql-statement-too-long/qaa-p/12496791#M4682849</guid>
      <dc:creator>raffaelw8</dc:creator>
      <dc:date>2022-03-29T06:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Statement too long</title>
      <link>https://community.sap.com/t5/technology-q-a/sql-statement-too-long/qaa-p/12496792#M4682850</link>
      <description>&lt;P&gt;Hi Raffael. &lt;/P&gt;&lt;P&gt;As we discussed, it is better if you save data in the table using 3 columns: "X", "Y", "value" -- it will help you then to match values by references.&lt;/P&gt;&lt;P&gt;As well, if you want to see examples of integrating HANA and Python using `hana-ml`: &lt;A href="https://github.com/SAP-samples/hana-ml-samples" target="test_blank"&gt;https://github.com/SAP-samples/hana-ml-samples&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 13:28:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sql-statement-too-long/qaa-p/12496792#M4682850</guid>
      <dc:creator>Vitaliy-R</dc:creator>
      <dc:date>2022-03-30T13:28:53Z</dc:date>
    </item>
  </channel>
</rss>

