Convert blob to array

Hello everybody.
I saw an article that describes how to bind array parameter.
The main idea is to send Varchar and convert it to array in a function.
This is the article:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:146012348066
The function is:
<code>
create or replace function in_list( p_string in varchar2 )
return myTableType
as
l_data myTableType := myTableType();
l_string long default p_string || ',';
l_n number;
begin
loop
exit when l_string is null;
l_data.extend;
l_n := instr( l_string, ',' );
l_data( l_data.count ) :=
substr( l_string, 1, l_n-1 );
l_string := substr( l_string, l_n+1 );
end loop;
return l_data;
end;
<code>
I want to send blob (binary) and convert it to array like the function do.
I want to send blob because the function above uses varchar that restrict to 4k and I want to send more than 4k chars.
How to do that?
Edited by: DevMTs on Mar 1, 2010 10:13 AM

The example I gave works - it just produces an extra null line so you need to modify it as follows:
create or replace function in_list( p_string in clob) return myTableType
as
l_data myTableType := myTableType();
l_n number := -1;
old_l_n number := 0;
begin
loop
l_n := instr( p_string || ',' , ',', old_l_n+1);
exit when l_n = 0;
l_data.extend;
l_data( l_data.count ) := substr( p_string|| ',', old_l_n+1, l_n-old_l_n-1);
old_l_n := l_n;
end loop;
return l_data;
end;I do not understand why you are getting an error
what have you defined the myTableType as?
what version of Oracle are you on?
Below I what I did to test the above function:
create type myTableType as table of varchar2(400);
-- generate clob with over 4K
var x clob;
declare
  i number
begin
  for i in 1..12 loop
     :x := :x || lpad('Loop - ' || i, 400) || ',';
  end loop
  :x := 'The End';
end;
-- test function
select * from table(in_list(:x));

Similar Messages

  • How to convert a 2D array of pixels in to a grayscale planar image

    Im having following problems, I hope someone may help me.
    1.     I want to convert a 2D array of pixels (Grayscale values) into a Grayscale PlannerImage. I tried the following code I found on net.
    The steps to do this are:
    -Construct a DataBuffer from your data array.
    -Construct a SampleModel describing the data layout.
    -Construct a Raster from the DataBuffer and SampleModel. You can use methods from the RasterFactory class to do this.
    -Construct a ColorModel which describes your data. The factory method PlanarImage.createColorModel(sampleModel) will take care of this for some common cases.
    -Construct a TiledImage with the SampleModel and ColorModel.
    -Populate the TiledImage with your data by using the TiledImage.setData() method to copy your raster into the TiledImage.
    Only the last step involves any actual processing. The rest is just object creation.
    public static RenderedImage createRenderedImage(float[][] theData, int width, int height, int numBands) {
    int len = width * height * numBands;
    Point origin = new Point(0,0);
    // create a float sample model
    SampleModel sampleModel =
    RasterFactory.createBandedSampleModel(DataBuffer.TYPE_FLOAT,width,height,numBands);
    // create a compatible ColorModel
    ColorModel colourModel = PlanarImage.createColorModel(sampleModel);
    // create a TiledImage using the float SampleModel
    TiledImage tiledImage = new TiledImage(origin,sampleModel,width,height);
    // create a DataBuffer from the float[][] array
    DataBufferFloat dataBuffer = new DataBufferFloat(theData, len);
    // create a Raster
    Raster raster = RasterFactory.createWritableRaster(sampleModel,dataBuffer,origin);
    // set the TiledImage data to that of the Raster
    tiledImage.setData(raster);
    RenderedImageAdapter img = new RenderedImageAdapter((RenderedImage)tiledImage);
    return img;
    I passed it 2D array of pixels with 3 bands, and it gave an exception >>Array index out of bounds at this line >>tiledImage.setData(raster). Then I tried it with a 1D array of length height*width with a single band. So Now it gives me a monochromatic RenderedImage. How can I make it a grayscale PlanarImage.

    jyang, thank you very much for your response. I believe I found a different solution all together, by converting each 16-bit intensity value into an 8-bit intensity value via an intensity ratio (ie: divide each intensity by the maximum and multiply by 256). The attachment shows the new program.
    Attachments:
    mod_image.vi ‏2004 KB

  • How to convert BLOB data into string format.

    Hi,
    I have problem while converting blob data into string format.
    for example,
    Select dbms_lob.substr(c.shape.Get_wkb(),4000,1) from geotable c
    will get me the first 4000 byte of BLOB .
    When i using SQL as i did above,the max length is 4000, but i can get 32K using plsql as below:
    declare
    my_var CLOB;
    BEGIN
    for x in (Select X from T)
    loop
    my_var:=dbms_lob.substr(x.X,32767,1)
    end loop
    return my_var;
    I comfortably convert 32k BLOB field to string.
    My problem is how to convert blob to varchar having size more than 32K.
    Please help me to resolve this,
    Thanx in advance for the support,
    Nilesh

    Nilesh,
    . . . .The result of get_wkb() will not be human readable (all values are encoded into some binary format).
    SELECT utl_raw.cast_to_varchar2(tbl.geometry.get_wkt()) from FeatureTable tbl;
    -- resulting string:
        ☺AW(⌂özßHAA
    Å\(÷. . . .You may also want to have a look at { dbms_lob | http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#i1015792 } "The DBMS_LOB package provides subprograms to operate on BLOBs, CLOBs, NCLOBs, BFILEs, and temporary LOBs."
    Regards,
    Noel

  • Converting BLOB to Varchar

    How can I convert a large BLOB to a varchar within Oracle? I tried to fetch the BLOB field to put into a VARCHAR2 field, but, if I select more than 4000, It is throwing an error - ORA:06502 PL/SQL: numeric or value error: raw variable length too long.
    Here is the query I executed for the blob datatype conversion in crystal reports and works fine but I am losing half of the document. If I put 4001, I get the error message above.
    SELECT package_id,
    (dbms_lob.substr(STORED_DOCS(IMPORT_PACKAGE_STORE. STORED_DOCUMENT),4000)) as stored
    FROM
    IMPORT_PACKAGE_STORE
    where package_id=1
    Here's the function STORED_DOCS...
    create or replace function STORED_DOCS(B BLOB)
    return clob is
    c clob;
    n number;
    begin
    if (b is null) then
    return null;
    end if;
    if (length(b)=0) then
    return empty_clob();
    end if;
    dbms_lob.createtemporary(c,true);
    n:=1;
    while (n+32767<=length(b)) loop
    dbms_lob.writeappend(c,32767,utl_raw.cast_to_varchar2(dbms_lob.substr(b,32767,n)));
    n:=n+32767;
    end loop;
    dbms_lob.writeappend(c,length(b)-n+1,utl_raw.cast_to_varchar2(dbms_lob.substr(b,length(b)-n+1,n)));
    return c;
    end;
    My question is: Is there any way to fetch more than 4000 char BLOB field into a VARCHAR2 field.?

    dhanu !! wrote:
    Hi,
    I have a table with a column type blob. This column has a file contents which is either encoded in utf-8 or utf-16 format. When the encoding is utf-16, if query the database and try access the column contents by converting blob data into clob (or blob to varchar)How do you check this? Is there any other column in the table which stores this information?
    - I do not see any valid data in the query result. All I get is inverted "?" and boxes suggesting invalid data.Most probably database and client character set mismatch or your client is not able to render the required font?

  • Converting BLOB to HEX and HEX to BLOB

    Hi!
    I have a table that stores pictures as BLOB. Due to some project rules, I need to be able to convert this image to a CLOB (represented as a HEX String) and, after that, I need to convert this HEX String back to BLOB.
    I already created the function that converts BLOB to HEX. See below:
    CREATE OR REPLACE FUNCTION blob_to_hex (blob_in IN BLOB)
    RETURN CLOB
    AS
        v_clob    CLOB;
        v_varchar VARCHAR2(32767);
        v_start   PLS_INTEGER := 1;
        v_buffer  PLS_INTEGER := 32767;
    BEGIN
        DBMS_LOB.CREATETEMPORARY(v_clob, TRUE);
        FOR i IN 1..CEIL(DBMS_LOB.GETLENGTH(blob_in) / v_buffer)
        LOOP
           v_varchar := DBMS_LOB.SUBSTR(blob_in, v_buffer, v_start);
           DBMS_LOB.WRITEAPPEND(v_clob, LENGTH(v_varchar), v_varchar);
           v_start := v_start + v_buffer;
        END LOOP;
       RETURN v_clob;
    END blob_to_hex;But, I´am having some difficulties to convert the HEX CLOB back to BLOB.
    Does anybody know how could I do this?
    Thanks a lot!!!
    Regis

    try this procedure
    first create directory BLOB_DIR
    CREATE OR REPLACE DIRECTORY
    BLOB_DIR AS 'C:\temp';
    CREATE OR REPLACE PROCEDURE BLOB_LOAD(filename varchar2)
    AS
    lBlob BLOB;
    lFile BFILE := BFILENAME('BLOB_DIR', filename);
    BEGIN
    INSERT INTO O_CONTRACT_IMAGES
    (CONTRACT_NO,CONTRACT_Year,CONTRACT_blob)
    VALUES (1,2, empty_blob())
    RETURNING CONTRACT_blob INTO lBlob;
    DBMS_LOB.OPEN(lFile, DBMS_LOB.LOB_READONLY);
    DBMS_LOB.OPEN(lBlob, DBMS_LOB.LOB_READWRITE);
    DBMS_LOB.LOADFROMFILE(DEST_LOB => lBlob,
    SRC_LOB => lFile,
    AMOUNT => DBMS_LOB.GETLENGTH(lFile));
    DBMS_LOB.CLOSE(lFile);
    DBMS_LOB.CLOSE(lBlob);
    COMMIT;
    END;
    Edited by: Hossam Kasem on 20-Apr-2011 05:56

  • How to convert blob data into clob using plsql

    hi all,
    I have requirement to convert blob column into clob .
    version details
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE     11.1.0.7.0     Production
    TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    DECLARE
       v_blob      temp.blob_column%TYPE;------this is blob data type column contains  (CSV file which is  inserted  from screens)
       v_clob      CLOB; --i want to copy blob column data into this clob
       v_warning   NUMBER;
    BEGIN
       SELECT blob_column
         INTO v_blob
         FROM temp
        WHERE pk = 75000676;
       DBMS_LOB.converttoclob (dest_lob          => v_clob,
                               src_blob          => v_blob,
                               amount            => DBMS_LOB.lobmaxsize,
                               dest_offset       => 1,
                               src_offset        => 1,
                               blob_csid         => 1, -- what  is the use of this parameter
                               lang_context      => 1,
                               warning           => v_warning
       DBMS_OUTPUT.put_line (v_warning);
    EXCEPTION
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.put_line (SQLCODE);
          DBMS_OUTPUT.put_line (SQLERRM);
    END;I am not getting what is the use of blob_csid , lang_context parameters after going the trough the documentation .
    Any help in this regard would be highly appreciated .......
    Thanks
    Edited by: prakash on Feb 5, 2012 11:41 PM

    Post the 4 digit Oracle version.
    Did you read the Doc for DBMS_LOB.CONVERTTOCLOB? - http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_lob.htm
    The function can convert data from one character set to another. If the source data uses a different character set than the target you need to provide the character set id of the source data.
    The blob_csid parameter is where you would provide the value for the source character set.
    If the source and target use the same character set then just pass zero. Your code is passing a one.
    >
    General Notes
    You must specify the character set of the source data in the blob_csid parameter. You can pass a zero value for blob_csid. When you do so, the database assumes that the BLOB contains character data in the same character set as the destination CLOB.
    >
    Same for 'lang_context' - your code is using 1; just use 0. It is an IN OUT
    >
    lang_context
    (IN) Language context, such as shift status, for the current conversion.
    (OUT) The language context at the time when the current conversion is done.
    This information is returned so you can use it for subsequent conversions without losing or misinterpreting any source data. For the very first conversion, or if do not care, use the default value of zero.

  • Convertion of byte array in UTF-8 to GSM character set.

    I want to convert byte array in UTF-8 to GSM character set. Please advice How can I do that?

    String s = new String(byteArrayInUTF8,"utf-8");This will convert your byte array to a Java UNICODE UTF-16 encoded String on the assumption that the byte array represents characters encoded as utf-8.
    I don't understand what GSM characters are so someone else will have to help you with the second part.

  • Converting BLOB to File

    Hello Friends,
    We have a requirement, we need to convert BLOB value as file and store it on unix box. Can we have only PLSQL for copying BLOB into a file and storing? Does it works for all the kinds of files with huze amout of data say 50 MB of data (or even more some times ) thi files are like .doc, .jpeg, .bmp, .pdf , .zip ...etc.
    Please give your suggestion on solving this.
    I will be thankful if you could give code snippet for this.
    Regards
    Sravan

    Thank You. We are using UTL_FILE.put_raw procedure to write to a file .
    We found it is working fine for .doc, .pdf, .jpeg.
    The same procedure failing while uploading .bmp files.
    Could you please tell is it required to handle different files differently? If so how do we differentiate these.
    Thank you again.

  • How to split the blob byte array and insert in oracle

    how to split the blob byte array and insert in oracle
    I am having a string which is of more than lenght 4000 so i am using BLOB datatype as input to get the string.
    need to split the blob in oracle and store in the different column
    The string is of bytearray i need to strore it in each column based on the byte array.

    this will be my input i need to split the above and store it in different columns in a table.
    for spliting say
    Column1 -1 byte
    Column2-3 byte
    Column3-5 byte
    ColumnN-5 byte
    Table will have corresponding data type
    Column1 - number(10,2)
    Column2 - Float
    Column3 - Float
    ColumnN-Float
    here Column2 datatype is float but it will always have 3 byte information.
    where as Column3 datatype is also float but it will always have 5 byte information.
    Say N is Column 120

  • How to convert arraylist into array

    how to convert arraylist into array?

    If you are using generics, I would use this version of toArray:
    List < X > list = ...
    X[] array = list.toArray(new X[list.size()]);If you are not using generics, that same thing looks like:
    List  list = ...
    X[] array = (X[]) list.toArray(new X[list.size()]);

  • How to convert an int array to string array?

    Hi,
    Can anyone please help me with this question?
    int number={4,6,45,3,2,77};
    I like to convert this into a list and sort
    List mylist = Arrays.asList(number);
    Collections.sort(mylist);
    But first I need to convert the int array to String array.
    Please advise. Thanks.

    If you want to convert your int array to a String array, you have no choice but doing a conversion element by element in a for loop.
    However, if the sort method doesn't behave as desired, you can use the one with 2 parameters, the second parameter being a comparator class.
    Check the javadoc for more information : http://java.sun.com/j2se/1.3/docs/api/java/util/Collections.html
    /Stephane

  • How Convert a Byte array to a image format

    Hi,
    How to convert a Byte array to an image format....I shall be more clear what i want...See i recieve a Byte array fom server this Byte array before recieveing at my end it was converted from an image/text format into a Byte array and is sent from server and, I recieve this Byte array now I have to convert this Byte array into their respective image....please tell me how to convert a Byte array to a image ......... Kindly explain clearly as i am new to Java......
    Thanking You.

    Note: This thread was originally posted in the [New To Java|http://forums.sun.com/forum.jspa?forumID=54] forum, but moved to this forum for closer topic alignment.

  • How do i convert a double array (with spaces and tabs) to a string?

    Hi
    In our files, we have a mixture of spaces and tabs as a delimeter. How do I convert a double array into a string?
    Thank you.

    Not sure about the last part of your question.
    The Search and Replace pattern can be better than the simple Search and Replace string when you have to do complex searchs, such as detecting multiple spaces.
    Have a look at the attachment.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    ReplaceSpaces.vi ‏27 KB

  • How to convert BLOB into a String

    Hi,
    I got a blob column from the database.
    It contains one XML File.
    How to convert it into String.
    I need the code for how to convert the blob into String
    Thanks in Advance.

    A blob would be a byte-array, which you can use in the String(byte[]) constructor

  • Unable to convert BLOB to XML using XMLTYPE

    Hello (XML) Experts
    I need your help with manipulating a BLOB column containing XML data - I am encountering the following error:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00200: could not convert from encoding UTF-8 to WINDOWS-1252
    Error at line 1
    ORA-06512: at "SYS.XMLTYPE", line 283
    I am on Windows 7 64 bit, Oracle 11.2.0.3 64 bit and database character set is WE8MSWIN1252, NLS_LANG is set to AMERICAN_AMERICA.AL32UTF8. The BLOB column contains the following XML data:
    <?xml version="1.0" encoding="utf-8"?>
    <Root CRC="-4065505">
      <Header Converted="0">
        <Version Type="String" Value="512" />
        <Revision Type="String" Value="29" />
        <SunSystemsVersion Type="String" Value="" />
        <Date Type="String" Value="20080724" />
        <Time Type="String" Value="165953" />
        <DAG Type="String" Value="" />
        <ChkID Type="String" Value="" />
        <FormType Type="String" Value="1" />
        <DB Type="String" Value="AllBusinessUnits" />
        <FuncID Type="String" Value="SOE" />
        <Status Type="String" Value="" />
        <FileType Type="String" Value="SFL" />
        <Descriptions>
          <Default Type="String" Value="Sales Order Entry" />
          <L01 Type="String" Value="Sales Order Entry" />
          <L33 Type="String" Value="Saisie commande client" />
          <L34 Type="String" Value="Entrada de órdenes de venta" />
          <L39 Type="String" Value="Inserimento ordine di vendita" />
          <L49 Type="String" Value="Aufträge erfassen" />
          <L55 Type="String" Value="Entrada de pedido de venda" />
          <L81 Type="String" Value="å?—注オーダー入力" />
          <L86 Type="String" Value="销售订å?•å½•å…¥" />
          <L87 Type="String" Value="銷售訂單錄入" />
        </Descriptions>
      </Header>
    <FormDesignerAppVer Type="String" Value="5.1" SFLOnly="1" />
    </Root>I am using the XMLTYPE constructor and passing in the BLOB column and the character set id of the XML data stored in the BLOB column in order to extract and update a node in the XML as follows:
    select xmltype(srce_form_detail,873) from SRCE_FORM where 873 above corresponds to the utf-8 encoding of the XML data in the BLOB column i.e. AL32UTF8, but this results in the above error.
    I have also tried converting the BLOB to a CLOB first as below where BLOB2CLOB is a function that converts the BLOB to a CLOB:
    select xmltype(BLOB2CLOB(srce_form_detail)).EXTRACT('/Root/Header/DB').getStringVal() XMLSrc  from SRCE_FORM;This results in the following error:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00210: expected '<' instead of '¿'
    Error at line 1
    ORA-06512: at "SYS.XMLTYPE", line 272
    ORA-06512: at line 1
    Looking at the XML in the BLOB I noticed that it contains a BOM(byte order mark) and this is causing the XML parsing to fail and I don't know how to deal with it and I don't want to simply SUBSTR it out.
    What I am trying to achieve is to extract the contents of the DB node in the XML and depending on its value I need to update the 'Value' part of that node. I am stuck at the point of extracting the contents of the DB node.
    I hope I have provided enough information and I would appreciate any suggestions on how best to resolve this - my XML knowledge is very limited so I would appreciate any help.
    Regards,
    Mohinder

    Hi Marc
    Thanks for your response.
    You are correct that the blob contains Japanese and Chinese characters but I was expecting that using the XMLTYPE constructor would convert the character set albeit with some data loss or then not display the Chinese and Japanese characters correctly.
    It seems to me that XMLTYPE is not handling/interpreting the BOM contained in the BLOB since even converting the BLOB to CLOB is resulting in an error. If I use SUBSTR and ignore the BOM to extract the XML from the BLOB then it works and as expected the Chinese and Japanese characters are not displayed correctly, they are displayed as '¿' corresponding to the lines beginning with L81, L86 & L87 , see below:
    select xmltype(SUBSTR(BLOB2CLOB(srce_form_detail),4)) from SRCE_FORM
    <?xml version="1.0" encoding="utf-8"?>
    <Root CRC="-4065505">
      <Header Converted="0">
        <Version Type="String" Value="512" />
        <Revision Type="String" Value="29" />
        <SunSystemsVersion Type="String" Value="" />
        <Date Type="String" Value="20080724" />
        <Time Type="String" Value="165953" />
        <DAG Type="String" Value="" />
        <ChkID Type="String" Value="" />
        <FormType Type="String" Value="1" />
        <DB Type="String" Value="AllBusinessUnits" />
        <FuncID Type="String" Value="SOE" />
        <Status Type="String" Value="" />
        <FileType Type="String" Value="SFL" />
        <Descriptions>
          <Default Type="String" Value="Sales Order Entry" />
          <L01 Type="String" Value="Sales Order Entry" />
          <L33 Type="String" Value="Saisie commande client" />
          <L34 Type="String" Value="Entrada de ¿¿rdenes de venta" />
          <L39 Type="String" Value="Inserimento ordine di vendita" />
          <L49 Type="String" Value="Auftr¿¿ge erfassen" />
          <L55 Type="String" Value="Entrada de pedido de venda" />
          <L81 Type="String" Value="¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿" />
          <L86 Type="String" Value="¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿" />
          <L87 Type="String" Value="¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿" />
        </Descriptions>
      </Header>Can you please let me know how I can extract the binary dump of the BLOB and post it on the forum as I don't know how to do this. Below is snippet of the hexadecimal dump, that includes the BOM. I can post the full hexadecimal dump if this can help you to reproduce the error ?
    EFBBBF3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D38223F3E0D0A3C526F6F74204352433D222D34303635353035223E0D0A20203C48656164657220436F6E7665727465643D2230223E0D0A202020203C56657273696F6E20547970653D22537472696E67222056616C75653D2235313222202F3E0D0A202020203C5265766973696F6E20547970653D22537472696E67222056616C75653D22323922202F3E0D0A202020203C53756E53797374656D7356657273696F6E20547970653D22537472696E67222056616C75653D2222202F3E0D0A202020203C4461746520547970653D22537472696E67222056616C75653D22323030383037323422202F3E0D0A202020203C54696D6520547970653D22537472696E67222056616C75653D2231363539353322202F3E0D0A202020203C44414720547970653D22537472696E67222056616C75653D2222202F3E0D0A202020203C43686B494420547970653D22537472696E67222056616C75653D2222202F3E0D0A202020203C466F726D5479706520547970653D22537472696E67222056616C75653D223122202F3E0D0A202020203C444220547970653D22537472696E67222056616C75653D22416C6C427573696E657373556E69747322202F3E0D0A202020203C46756E63494420547970653D22537472696E67222056616C75653D22534F4522202F3E0D0A202020203C53746174757320547970653D22537472696E67222056616C75653D2222202F3E0D0A202020203C46696C655479706520547970653D22537472696E67222056616C75653D2253464C22202F3E0D0A202020203C4465736372697074696F6E733E0D0A2020202020203C44656661756C7420547970653D22537472696E67222056616C75653D2253616C6573204F7264657220456E74727922202F3E0D0A2020202020203C4C303120547970653D22537472696E67222056616C75653D2253616C6573204F7264657220456E74727922202F3E0D0A2020202020203C4C333320547970653D22537472696E67222056616C75653D2253616973696520636F6D6D616E646520636C69656E7422202F3E0D0A2020202020203C4C333420547970653D22537472696E67222056616C75653D22456E747261646120646520C3B37264656E65732064652076656E746122202F3E0D0A2020202020203C4C333920547970653D22537472696E67222056616C75653D22496E736572696D656E746F206F7264696E652064692076656E6469746122202F3E0D0A2020202020203C4C343920547970653D22537472696E67222056616C75653D224175667472C3A4676520657266617373656E22202F3E0D0A2020202020203C4C353520547970653D22537472696E67222056616C75653D22456E74726164612064652070656469646F2064652076656E646122202F3E0D0A2020202020203C4C383120547970653D22537472696E67222056616C75653D22E58F97E6B3A8E382AAE383BCE38380E383BCE585A5E58A9B22202F3E0D0A2020202020203C4C383620547970653D22537472696E67222056616C75653D22E99480E594AEE8AEA2E58D95E5BD95E585A522202F3E0D0A2020202020203C4C383720547970653D22537472696E67222056616C75653D22E98AB7E594AEE8A882E596AEE98C84E585A522202F3E0D0A202020203C2F4465736372697074696F6E733E0D0A20203C2F4865616465723E0D0A20203C466F726D3E0D0A202020203C4372656174696F6E4C616E6720547970653D22537472696E67222056616C75653D223031222053464C4F6E6C793D223122202F3E0D0A202020203C416374696F6E733E0D0A2020202020203C5065726D697373696F6E73202F3E0D0A202020203C2F416374696F6E733E0D0A202020203C48656C70202F3E0D0A202020203C466F6E743E0D0A2020202020203C446566466F6E7453697A6520547970653D22496E7465676572222056616C75653D2238222053464C4F6E6C793D223122202F3E0D0A2020202020203C466F6E743E0D0A20202020202020203C4C616E677561676520547970653D22537472696E67222056616C75653D2244656661756C7422202F3E0D0A20202020202020203C466F6E744E616D6520547970653D22537472696E67222056616C75653D224D532053616E7320536572696622202F3E0D0A2020202020203C2F466F6E743E0D0A2020202020203C466F6E743E0D0A20202020202020203C4C616E677561676520547970653D22537472696E67222056616C75653D22383122202F3E0D0A20202020202020203C466F6E744E616D6520547970653D22537472696E67222056616C75653D224D5320554920476F7468696322202F3E0D0A2020202020203C2F466F6E743E0D0A202020203C2F466F6E743E0D0A202020203C436F6E74726F6C733E0D0A2020202020203C436F6E74726F6C3E0D0A20202020202020203C436F6E74726F6C5479706520547970653D22496E746567657222204644496E743D2231222056616C75653D223122202F3E0D0A20202020202020203C446973706C61795479706520547970653D22537472696E6722204644496E743D2230222056616C75653D22466F726D2057696E646F77222053464C4F6E6C793D223122202F3E0D0A20202020202020203C43617074696F6E20547970653D22537472696E6722204644496E743D2230222056616C75653D2253597C3F7C55547C3F7C3F3F3F3F3F3F22202F3E0DThe XML I posted so far is actually truncated as the full XML is quite big but I showed the beginning of it as this is the section I believe that is not being handled properly. Furthermore I am able to write the BLOB out to a file successfully without any errors using DBMS_LOB & UTL_FILE.PUT_RAW and this seems to handle the BOM without any issues but what I really need to do is read a single node in the XML and update it directly preferably using XMLTYPE directly with the BLOB.
    I would welcome your suggestions on how best to read a single node and update it when the XML is contained in a BLOB.
    Regards,
    Mohinder

Maybe you are looking for