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?
Thank you in advance.
Here are some more details:
Here is the ddl of the table:
CREATE TABLE MAPSHEET
(
MAPSHEETID NUMBER (14,0) NOT NULL,
NAME VARCHAR2 (64) NOT NULL,
STRUCTURE BLOB,
)
the xml data in the blob col STRUCTURE
<MapSheet Version="1.0">
<Frame>
<JobId>9022165</JobId>
<LayoutId>24807064</LayoutId>
<Blocks>
<Block MapFieldMask="true" CompressText="false" CombineRaster="false">
<Name>layout</Name>
<StyleId>24808857</StyleId>
<LayoutLayers>0 1</LayoutLayers>
<BlockScale/>
<JobItemIds/>
</Block>
<Block MapFieldMask="true" CompressText="false" CombineRaster="false">
<Name>karto</Name>
<StyleId>24809031</StyleId>
<LayoutLayers>4</LayoutLayers>
<BlockScale/>
<JobItemIds>
<JobItemId>9083675</JobItemId>
<JobItemId>9088148</JobItemId>
</JobItemIds>
</Block>
<Block MapFieldMask="true" CompressText="false" CombineRaster="false">
<Name>hel</Name>
<StyleId>24809032</StyleId>
<LayoutLayers>-</LayoutLayers>
<BlockScale/>
<JobItemIds>
<JobItemId>9022173</JobItemId>
<JobItemId>25403646</JobItemId>
</JobItemIds>
</Block><Block MapFieldMask="true" CompressText="false" CombineRaster="false">
<Name>shade glacier</Name>
<StyleId>24809041</StyleId>
<LayoutLayers>-</LayoutLayers>
<BlockScale/>
<JobItemIds>
<JobItemId>24806040</JobItemId>
</JobItemIds>
</Block>
<Block MapFieldMask="true" CompressText="false" CombineRaster="false">
<Name>shade</Name>
<StyleId>24809040</StyleId>
<LayoutLayers>-</LayoutLayers>
<BlockScale/>
<JobItemIds>
<JobItemId>24806038</JobItemId>
</JobItemIds>
</Block>
</Blocks>
<Offset X="0" Y="0"/>
<Name>DS</Name>
</Frame></MapSheet>
This simple SELECT to get the data does not work:
SELECT x.MapSheet
FROM XmlTable('/MapSheet') PASSING XmlType(MAPSHEET.STRUCTURE,1)
COLUMS "XML" VARCHAR2(300) PATH 'MapSheet') AS x;
How can i select/update the desired xml data out of the blob colum?