title: Select and Update Oracle BLOB column with XMLQUERY
body: <p>I have to update XML values stored in an BLOB column in Oracle 11G. The BLOB has stored a comlete XML file in which i have to update some values and save it back as a BLOB. How can i easily SELECT and UPDATE the data wit blob conversion and XMLQUERY AND XMLUPDATE? Any code examples? </p>
  
  <p>Thank you in advance.</p>
  
  <p>Here are some more details:</p>
  
  <p>Here is the ddl of the table:</p>
  
  <pre><code>CREATE TABLE MAPSHEET
  (
    MAPSHEETID NUMBER (14,0) NOT NULL,
    NAME VARCHAR2 (64) NOT NULL,
    STRUCTURE BLOB,
  )
  </code></pre>
  
  <p>the xml data in the blob col STRUCTURE</p>
  
  <pre><code>&lt;MapSheet Version="1.0"&gt;
      &lt;Frame&gt;
          &lt;JobId&gt;9022165&lt;/JobId&gt;
          &lt;LayoutId&gt;24807064&lt;/LayoutId&gt;
          &lt;Blocks&gt;
              &lt;Block MapFieldMask="true" CompressText="false" CombineRaster="false"&gt;
                  &lt;Name&gt;layout&lt;/Name&gt;
                  &lt;StyleId&gt;24808857&lt;/StyleId&gt;
                  &lt;LayoutLayers&gt;0 1&lt;/LayoutLayers&gt;
                  &lt;BlockScale/&gt;
                  &lt;JobItemIds/&gt;
              &lt;/Block&gt;
              &lt;Block MapFieldMask="true" CompressText="false" CombineRaster="false"&gt;
                  &lt;Name&gt;karto&lt;/Name&gt;
                  &lt;StyleId&gt;24809031&lt;/StyleId&gt;
                  &lt;LayoutLayers&gt;4&lt;/LayoutLayers&gt;
                  &lt;BlockScale/&gt;
                  &lt;JobItemIds&gt;
                      &lt;JobItemId&gt;9083675&lt;/JobItemId&gt;
                      &lt;JobItemId&gt;9088148&lt;/JobItemId&gt;
                  &lt;/JobItemIds&gt;
              &lt;/Block&gt;
              &lt;Block MapFieldMask="true" CompressText="false" CombineRaster="false"&gt;
                  &lt;Name&gt;hel&lt;/Name&gt;
                  &lt;StyleId&gt;24809032&lt;/StyleId&gt;
                  &lt;LayoutLayers&gt;-&lt;/LayoutLayers&gt;
                  &lt;BlockScale/&gt;
                  &lt;JobItemIds&gt;
                      &lt;JobItemId&gt;9022173&lt;/JobItemId&gt;
                      &lt;JobItemId&gt;25403646&lt;/JobItemId&gt;
                  &lt;/JobItemIds&gt;
              &lt;/Block&gt;&lt;Block MapFieldMask="true" CompressText="false" CombineRaster="false"&gt;
                  &lt;Name&gt;shade glacier&lt;/Name&gt;
                  &lt;StyleId&gt;24809041&lt;/StyleId&gt;
                  &lt;LayoutLayers&gt;-&lt;/LayoutLayers&gt;
                  &lt;BlockScale/&gt;
                  &lt;JobItemIds&gt;
                      &lt;JobItemId&gt;24806040&lt;/JobItemId&gt;
                  &lt;/JobItemIds&gt;
              &lt;/Block&gt;
              &lt;Block MapFieldMask="true" CompressText="false" CombineRaster="false"&gt;
                  &lt;Name&gt;shade&lt;/Name&gt;
                  &lt;StyleId&gt;24809040&lt;/StyleId&gt;
                  &lt;LayoutLayers&gt;-&lt;/LayoutLayers&gt;
                  &lt;BlockScale/&gt;
                  &lt;JobItemIds&gt;
                      &lt;JobItemId&gt;24806038&lt;/JobItemId&gt;
                  &lt;/JobItemIds&gt;
              &lt;/Block&gt;
          &lt;/Blocks&gt;
          &lt;Offset X="0" Y="0"/&gt;
          &lt;Name&gt;DS&lt;/Name&gt;
      &lt;/Frame&gt;&lt;/MapSheet&gt;
  </code></pre>
  
  <p>This simple SELECT to get the data does not work:</p>
  
  <pre><code>SELECT x.MapSheet
  FROM XmlTable('/MapSheet') PASSING XmlType(MAPSHEET.STRUCTURE,1)
      COLUMS "XML" VARCHAR2(300) PATH 'MapSheet') AS x;
  </code></pre>
  
  <p>How can i select/update the desired xml data out of the blob colum?</p>