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?

Similar Messages

  • 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

  • Saving result from sp_executesql into a variable and using dynamic column name - getting error "Error converting data type varchar to numeric"

    Im getting an error when running a procedure that includes this code.
    I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql
    DECLARE @retval AS DECIMAL(12,2)
    DECLARE @MonthVal VARCHAR(20), @SpreadKeyVal INT
    DECLARE @sqlcmd AS NVARCHAR(150)
    DECLARE @paramdef NVARCHAR(150)
    SET @MonthVal = 'Month' + CAST(@MonthNumber AS VARCHAR(2) );
    SET @SpreadKeyVal = @SpreadKey; --CAST(@SpreadKey AS VARCHAR(10) );
    SET @sqlcmd = N' SELECT @retvalout = @MonthVal FROM dbo.CourseSpread WHERE CourseSpreadId = @SpreadKeyVal';
    SET @paramdef = N'@MonthVal VARCHAR(20), @SpreadKeyVal INT, @retvalout DECIMAL(12,2) OUTPUT'
    --default
    SET @retval = 0.0;
    EXECUTE sys.sp_executesql @sqlcmd,@paramdef, @MonthVal = 'Month4',@SpreadKeyVal = 1, @retvalout = @retval OUTPUT;
    SELECT @retval
    DECLARE @return_value DECIMAL(12,2)
    EXEC @return_value = [dbo].[GetSpreadValueByMonthNumber]
    @SpreadKey = 1,
    @MonthNumber = 4
    SELECT 'Return Value' = @return_value
    Msg 8114, Level 16, State 5, Line 1
    Error converting data type varchar to numeric.

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    >> I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql <<
    This is so very, very wrong! A column is an attribute of an entity. The idea that you are so screwed up that you have no idea if you want
    the shoe size, the phone number or something else at run time of this entity. 
    In Software Engineering we have a principle called cohesion that says a model should do one and only one task, have one and only one entry point, and one and only one exit point. 
    Hey, on a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, your mindset is that level of sillyity and absurdity. 
    Do you know that SQL is a declarative language? This family of languages does not use local variables! 
    Now think about “month_val” and what it means. A month is a temporal unit of measurement, so this is as silly as saying “liter_val” in your code. Why did you use “sp_” on a procedure? It has special meaning in T-SQL.  
    Think about how silly this is: 
     SET @month_val = 'Month' + CAST(@month_nbr AS VARCHAR(2));
    We do not do display formatting in a query. This is a violation of at the tiered architecture principle. We have a presentation layer. But more than that, the INTERVAL temporal data type is a {year-month} and never just a month. This is fundamental. 
    We need to see the DDL so we can re-write this mess. Want to fix it or not?
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Crystal Data Conversion Issue (Error converting data type varchar to datetime)

    Hi,
    I can run stored procedure without error in SQL Server using my personal credentials as well as database credentials.
    I can also run Crystal Report after connecting to Stored procedure without error on my desktop using my personal credentials as well as database credentials.
    But when I upload the crystal report in BOBJDEV and when I run using database credentials report fails saying that "Error in File ~tmp1d1480b8e70fd90.rpt: Unable to connect: incorrect log on parameters. Details: [Database Vendor Code: 18456 ]" but I can run the crystal report successfully on BOBJDEV using my personal credentials.
    I googled (Data Conversion Error Message) about this issue & lot of people asked to do "Verify Database" in Crystal Report. So I did that, but when I do it I am getting a error message like this:
    Error converting data type varchar to datetime.
    Where do you think the error might be occurring? Did anyone faced this kind of issue before? If so, how to resolve it?
    (FYI, I am using Crystal Reports 2008, & for stored procedure I have used SSMS 2012 )
    Please help me with this issue.
    Thanks & Regards.
    Naveen.

    hello Naveen,
    since the report works fine in the cr designer / desktop, we need to figure out where you should post this question.
    by bobjdev do you mean businessobjects enterprise or crystal reports server? if so please post this question to the bi platform space.
    -jamie

  • 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.

  • 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.

  • View to convert table with blob to varchar

    Hello,
    Is it possible to create a view on table which contains BLOB field to have it in the view as varchar?
    Thanks for your advices

    In general, no
    BLOBs can have binary data - VARCHARs cannot
    BLOBs can be really really large - VARCHARs have a limit
    John

  • 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));

  • 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

  • Converting text to varchar in a variable

    hi all,
    i am getting  CUSTMER_ID  like ('1234','23456','23445','9845'.....)  almost 3k  Customers in single row, i am selecting this from a table a running through execute SQL task and  capturing the result in a variable , but when i try
    execute the task i am getting the error saying variable value is differs from the current variable. i converted the column to varchar(max) but no use.
    please help me to solve this issue , any help will be appreciated. 

    SSIS doesn't recognize VARCHAR(MAX). So,
    Try using SELECT CAST(CUSTOMER_ID AS VARCHAR(8000)) Cust_ID FROM YourTable and map this "Cust_ID" column in Result Set.
    If your result is exceeding the limit, store it in Object variable.
    Later you can access Cust_ID by using ForEach Loop or using Script Task.
    -Vaibhav Chaudhari

  • 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

  • How to convert Date in varchar(50) format MM/DD/YYYY HH:MM into YYYY-MM-DD format using MS SQLServer 2008 R2 ?

    Hi,
    I am getting the error "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value."
    when converting date in format Date in varchar(50) format MM/DD/YYYY HH:MM into YYYY-MM-DD format using MS SQLServer 2008 R2.
    Please note that the date in column is Date(varchar(50), null).
    I used the following syntax:
    SELECT  CONVERT(VARCHAR(10), Date, 102) AS Day
    FROM   dbo.[RCap_2G MM/Operator]
    WHERE  (CONVERT(VARCHAR(10), Date, 102) > { fn NOW() } - 1)

    As noted above, either use ISDATE or TRY_CONVERT with the correct conversion style number:
    -- SQL Server 2012 code
    DECLARE @Date varchar(50) = '10/23/2006 10:20';
    SELECT TRY_CONVERT(DATE, @Date, 101) AS Day
    -- 2006-10-23
    Datetime conversion blog:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to convert date in varchar format to TimeZone format?

    Hi,
    Iam having a date '14-05-08 09:46:35 AM' (in Varchar format). How to convert this date to TimeZone ('IYYY-MM-DD"T"HH12:MI:SS"Z"FX') format?
    For Example,
    My input date is '14-05-08 09:46:35 AM' and I need output as '2008-05-14T09:46:35Z'.
    How to convert this?
    Thanks in Advance.

    Hi,
    You would look up the TO_TIMESTAMP and the TO_CHAR functions in the SQL reference manual for the version you don't mention, and make up the solution yourself, rather than asking someone else to do your homework.
    Sybrand Bakker
    Senior Oracle DBA

  • Convert BLOB in RTF Format to BLOB in PDF Format

    Hi
    I am having a BLOB in database in RTF format and I want to convert this to BLOB in PDF format. Can this be done ?
    Thanks
    Jamith

    i fear not with pl/sql only.
    You will need a external tool, in example:
    http://www.freedownloadscenter.com/Best/rtf2pdf-font.html

Maybe you are looking for

  • No Bootable Disk Error

    I have had this computer since August 2012. I have recently been getting a "No bootable disk" error when starting/restarting. I hold down the option key, select the SSD, and it boots normally. The first time it happened I kinda freaked, now it just *

  • Photoshop Elements 10 on 64 bit Windows 7 installtion Problem

    I purchased Adobe Photoshop Elements10, Trying to install on 64 bit Window7. I put Disk #1, computer started to process/install it and then asked me to Put disk # 2. I put it. It gave me the option of  ' Trial Version' only NOT for the purchased soft

  • Update to Elements 9.0.3 messed up Organizer Catalog

    I recently updated my installed copy of Photoshop Elements 9 to version 9.0.3 using the link imbedded in my copy of Elements 9 .  Shortly after I moved to Elements 9 with a successful transfer of my image catalog from Elements 8, I updated to version

  • SQL query very slow on Data warehouse

    Guys, Is there any soul who is an expert on SQL ? I do run this query agaist a 2 table and a view which has 30 million rows. Unfortunately the table is partitioned but not the Unique index. This query takes about 3 hours to run. Is there anyway of wr

  • Cisco Agent Desktop incorrect stats Agent Statistics Display

    Hi, I have a very strange problem with a cisco agent desktop user. The times/numbers as displayed in the Agent Statistics Display are incorrect. As you can see from image 1, the agent was presented with 14 calls. The total talking time is 7:22. Howev