title: SQL select Query for Column with Multi Value field is Equated to NULL
body: <p>I need your help to frame a SQL query in Oracle . I am creating a XML type Table in Oracle Database  and making one column of it a Multi Value Field.  The data given to the Multi Value column for the records are of different cases with Multi Value and Sub Value.  (Ex : ( “ ” : @VM: “ 10 ”) , (“ 12” : @VM: “ ”) , (“ ” : @SM: “ 8 ”) , (“ 6” : @SM: “ ”)) . When a SQL query is executed to select the records for which the Multi value column is equated to Null, the record where the first value of @SM is NULL is not getting selected ie. (“ ” : @SM: “ 8 ”).</p>
  <p>Table Creation :</p>
  <pre><code>CREATE TABLE &quot;F_TESTMV&quot; (RECID VARCHAR2(255) NOT NULL PRIMARY KEY, XMLRECORD XMLTYPE) XMLTYPE COLUMN XMLRECORD STORE AS CLOB
  CREATE TABLE D_F_TESTMV (RECID VARCHAR2(255) NOT NULL PRIMARY KEY, XMLRECORD CLOB)
  </code></pre>
  <p>Insert Statement :</p>
  <pre><code>INSERT INTO TAFJ24.F_TESTMV (RECID,XMLRECORD) VALUES
                ('11000',TO_CLOB(' &lt;row id='11000'&gt;&lt;c1&gt;&lt;/c1&gt;&lt;c1 m='2'&gt;US&lt;/c1&gt;&lt;/row&gt;')),
                ('12000',TO_CLOB(' &lt;row id='12000'&gt;&lt;c1&gt;US&lt;/c1&gt;&lt;c1 m='2'&gt;&lt;/c1&gt;&lt;/row&gt;')),
                ('13000',TO_CLOB(' &lt;row id='13000'&gt;&lt;c1&gt;GB&lt;/c1&gt;&lt;c1 m='2'&gt;US&lt;/c1&gt;&lt;/row&gt;')),
                ('14000',TO_CLOB(' &lt;row id='14000'&gt;&lt;c1&gt;US&lt;/c1&gt;&lt;c1 m='2'&gt;GB&lt;/c1&gt;&lt;/row&gt;'));
                ('15000',TO_CLOB('&lt;row id='15000'&gt;&lt;c1&gt;OF&lt;/c1&gt;&lt;c1 m='2'&gt;&lt;/c1&gt;&lt;/row&gt;')),
                ('16000',TO_CLOB('&lt;row id='16000'&gt;&lt;c2&gt;gb&lt;/c2&gt;&lt;/row&gt;')),
                ('17000',TO_CLOB(&lt;row id='17000'&gt;&lt;c1&gt;US&lt;/c1&gt;&lt;c1 m='1' s='2'&gt;&lt;/c1&gt;&lt;/row&gt;'));
                ('18000',TO_CLOB('&lt;row id='18000'&gt;&lt;c1 m='1' s='2'&gt;GB&lt;/c1&gt;&lt;/row&gt;'));
  </code></pre>
  <p>View Definition:</p>
  <pre><code>SELECT a.RECID, a.XMLRECORD &quot;THE_RECORD&quot;,extractValue(a.XMLRECORD,'/row/c1[position()=1]') &quot;COUNTRY&quot; ,extract(a.XMLRECORD,'/row/c1') &quot;COUNTRY_1&quot; FROM  &quot;F_TESTMV&quot;
  </code></pre>
  <p>Select Query :</p>
  <pre><code>SELECT RECID FROM &quot;V_F_TESTMV&quot; WHERE  ( XMLEXISTS('$t[/row/c1[not(text())][not(*)] or /row/c1/text()= &quot;&quot;  or fn:not(/row/c1/text()) ] ' PASSING &quot;THE_RECORD&quot; as &quot;t&quot;) )
  </code></pre>
  <p>Current Result :
  From the eight records in the table, The above SQL query selects 5 records, with RECID 11000,12000,15000,16000,17000. It does not select RECID 18000 even when the first part of Sub Value is NULL in the record.</p>
  <p>EXPECTED RESULT
  The Query should select 6 Records . The records with RECID 11000,12000,15000,16000,17000 and 18000 should be selected, as  RECID 18000 also has first part of Sub Value as NULL.
  Kindly provide your Suggestion on the SQL Query required that will fetch the above records when the name of the Column with Multi Value field is Equated to NULL.
  Thanks</p>