<?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: empty table producing hash value in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/empty-table-producing-hash-value/qaa-p/13843297#M4874140</link>
    <description>&lt;P&gt;It has to do with the LIST aggregate you are using as argument for the HASH function.&lt;/P&gt;
&lt;P&gt;SELECT LIST(null) by definition returns an empty string, and that prevents HASH from returning null.&lt;/P&gt;
&lt;P&gt;(The hash value in your sample is that of an empty string.)&lt;/P&gt;</description>
    <pubDate>Tue, 19 Sep 2017 06:09:00 GMT</pubDate>
    <dc:creator>VolkerBarth</dc:creator>
    <dc:date>2017-09-19T06:09:00Z</dc:date>
    <item>
      <title>empty table producing hash value</title>
      <link>https://community.sap.com/t5/technology-q-a/empty-table-producing-hash-value/qaq-p/13843296</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I have no data in a table,
&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;
$ dbisql -c "uid=sadb;pwd=sadb;eng=ftnode_sa;links=tcpip(host=10.11.12.17;port=49153);LOG=conn.log;dbn=ftnode_sa" "select * from test1"
x y &lt;P&gt;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&lt;CODE&gt;(0 rows)
&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;yet when I run a hash query over the results, I get a hash value:&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;
$ dbisql -c "uid=sadb;pwd=sadb;eng=ftnode_sa;links=tcpip(host=10.11.12.17;port=49153);LOG=conn.log;dbn=ftnode_sa" "select hash(list(hash_val,'' ORDER BY hash_val), 'MD5') as hash_val from (select hash( x||y, 'MD5') as hash_val from (select x,y from test1) as ht) as ht"
hash_val                         
--------------------------------
d41d8cd98f00b204e9800998ecf8427e 
&lt;/LI-CODE&gt;

&lt;P&gt;When I perform the same test in PostgreSQL and Oracle then no hash value is returned, which is as expected. Note, when a table does have row data then the hash value matches to Oracle and PostgreSQL, but not so with empty tables.&lt;/P&gt;
&lt;P&gt;Could somebody suggest why ?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 18 Sep 2017 23:11:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/empty-table-producing-hash-value/qaq-p/13843296</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-09-18T23:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: empty table producing hash value</title>
      <link>https://community.sap.com/t5/technology-q-a/empty-table-producing-hash-value/qaa-p/13843297#M4874140</link>
      <description>&lt;P&gt;It has to do with the LIST aggregate you are using as argument for the HASH function.&lt;/P&gt;
&lt;P&gt;SELECT LIST(null) by definition returns an empty string, and that prevents HASH from returning null.&lt;/P&gt;
&lt;P&gt;(The hash value in your sample is that of an empty string.)&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2017 06:09:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/empty-table-producing-hash-value/qaa-p/13843297#M4874140</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2017-09-19T06:09:00Z</dc:date>
    </item>
  </channel>
</rss>

