PL/SQL Help...Long Raw to BLOB

Hello All,
I have a PL/SQL Package and Function that does a search for text in a blob field. Below is the Package and the Function.
Here the statement that executes the function
Select *
           FROM PROGTXT
          WHERE pcode.str_loc_in_blob
                                    (pcode.blob_to_new_blob (progtxt),
                                     '<search string>'
                                    ) <> 0
       ORDER BY objectvalue1, objectvaluesCurrently the above mentioned sql works where the progtxt is a blob datatype.
We have a database where the progtxt is of Long Raw datatype. I want to utilize the same sql exactly but change the function where i can copy the table structure to a global temporary table each time the function is executed using the dbms_lob funtion and delete the temp table once the function is executed after the results are posted/retrieved. The reason why i want to use the same application is because it is part of a .net program and the only thing i change is the function. I am not great with PL/SQL. If anyone can help that will be a great help!!!!!
Below is the code for the package and the function
CREATE OR REPLACE PACKAGE PCODE AS
FUNCTION to_base (p_dec IN NUMBER, p_base IN NUMBER)
   RETURN VARCHAR2
FUNCTION to_dec (
   p_str         IN   VARCHAR2,
   p_from_base   IN   NUMBER DEFAULT 16
   RETURN NUMBER
FUNCTION to_hex (p_dec IN NUMBER)
   RETURN VARCHAR2
FUNCTION to_bin (p_dec IN NUMBER)
   RETURN VARCHAR2
FUNCTION to_oct (p_dec IN NUMBER)
   RETURN VARCHAR2
FUNCTION str_to_hex(p_str IN VARCHAR2)
RETURN VARCHAR2
FUNCTION str_loc_in_blob(
  l_blob IN BLOB
, l_str  IN VARCHAR2)
RETURN NUMBER
FUNCTION blob_to_new_blob(
  p_blob IN BLOB)
RETURN BLOB
END PCODE;
CREATE OR REPLACE PACKAGE BODY PCODE AS
FUNCTION to_base (p_dec IN NUMBER, p_base IN NUMBER)
   RETURN VARCHAR2
IS
   l_str   VARCHAR2 (255) DEFAULT NULL;
   l_num   NUMBER         DEFAULT p_dec;
   l_hex   VARCHAR2 (16)  DEFAULT '0123456789abcdef';
BEGIN
   IF (p_dec IS NULL OR p_base IS NULL)
   THEN
      RETURN NULL;
   END IF;
   IF (TRUNC (p_dec) <> p_dec OR p_dec < 0)
   THEN
      RAISE PROGRAM_ERROR;
   END IF;
   LOOP
      l_str := SUBSTR (l_hex, MOD (l_num, p_base) + 1, 1) || l_str;
      l_num := TRUNC (l_num / p_base);
      EXIT WHEN (l_num = 0);
   END LOOP;
   RETURN l_str;
END to_base;
FUNCTION to_dec (
   p_str         IN   VARCHAR2,
   p_from_base   IN   NUMBER DEFAULT 16
   RETURN NUMBER
IS
   l_num   NUMBER        DEFAULT 0;
   l_hex   VARCHAR2 (16) DEFAULT '0123456789abcdef';
BEGIN
   IF (p_str IS NULL OR p_from_base IS NULL)
   THEN
      RETURN NULL;
   END IF;
   FOR i IN 1 .. LENGTH (p_str)
   LOOP
      l_num :=
         l_num * p_from_base + INSTR (l_hex, UPPER (SUBSTR (p_str, i, 1)))
         - 1;
   END LOOP;
   RETURN l_num;
END to_dec;
FUNCTION to_hex (p_dec IN NUMBER)
   RETURN VARCHAR2
IS
BEGIN
   RETURN to_base (p_dec, 16);
END to_hex;
FUNCTION to_bin (p_dec IN NUMBER)
   RETURN VARCHAR2
IS
BEGIN
   RETURN to_base (p_dec, 2);
END to_bin;
FUNCTION to_oct (p_dec IN NUMBER)
   RETURN VARCHAR2
IS
BEGIN
   RETURN to_base (p_dec, 8);
END to_oct;
FUNCTION str_to_hex(p_str IN VARCHAR2)
RETURN VARCHAR2 IS
l_val VARCHAR2(2000) := NULL;
BEGIN
   FOR i IN 1 .. LENGTH (p_str)
   LOOP
      l_val := l_val || to_hex(ASCII(SUBSTR (p_str, i, 1))) || case when i = LENGTH (p_str) then null else '00' end;
   END LOOP;
   RETURN UPPER(l_val);
END str_to_hex;
FUNCTION str_loc_in_blob(
  l_blob IN BLOB
, l_str  IN VARCHAR2)
RETURN NUMBER IS
blob_len NUMBER;
l_pos number := 0;
BEGIN
blob_len := dbms_lob.getlength(l_blob);
l_pos := 0;
FOR i in 0..15 LOOP
    l_pos := dbms_lob.instr(DBMS_LOB.SUBSTR (l_blob, 2000, i*2000+1), IMPACTUS_PCODE.str_to_hex((l_str)));
    IF l_pos <> 0 THEN
       RETURN i*2000+1 + l_pos - 1;
    END IF;
END LOOP;
FOR i in 0..15 LOOP
    l_pos := dbms_lob.instr(DBMS_LOB.SUBSTR (l_blob, 2000, i*2000+1), IMPACTUS_PCODE.str_to_hex(upper(l_str)));
    IF l_pos <> 0 THEN
       RETURN i*2000+1 + l_pos - 1;
    END IF;
END LOOP;
l_pos := 0;
FOR i in 0..15 LOOP
    l_pos := dbms_lob.instr(DBMS_LOB.SUBSTR (l_blob, 2000, i*2000+1), IMPACTUS_PCODE.str_to_hex(lower(l_str)));
    IF l_pos <> 0 THEN
       RETURN i*2000+1 + l_pos - 1;
    END IF;
END LOOP;
l_pos := 0;
FOR i in 0..15 LOOP
    l_pos := dbms_lob.instr(DBMS_LOB.SUBSTR (l_blob, 2000, i*2000+1), IMPACTUS_PCODE.str_to_hex(initcap(l_str)));
    IF l_pos <> 0 THEN
       RETURN i*2000+1 + l_pos - 1;
    END IF;
END LOOP;
RETURN 0;
END str_loc_in_blob;
FUNCTION blob_to_new_blob(p_blob BLOB)
   RETURN BLOB IS
v_file_blob     BLOB;  
v_file_blob_new BLOB := NULL;
v_file_clob     CLOB;  
v_file_size     INTEGER := dbms_lob.lobmaxsize;
v_dest_offset   INTEGER := 1;
v_src_offset    INTEGER := 1;
v_blob_csid     NUMBER := dbms_lob.default_csid;
v_lang_context  NUMBER := dbms_lob.default_lang_ctx;
v_warning       INTEGER;
BEGIN
DBMS_LOB.CREATETEMPORARY(v_file_clob, TRUE);
        dbms_lob.convertToClob(
                        v_file_clob,
                        p_blob,
                        v_file_size,
                        v_dest_offset,
                        v_src_offset,
                        v_blob_csid,
                        v_lang_context,
                        v_warning);
        v_file_clob:=upper(v_file_clob);
        IF v_warning = 0 THEN
                v_file_size     := dbms_lob.lobmaxsize;
                v_dest_offset   := 1;
                v_src_offset    := 1;
                v_blob_csid     := dbms_lob.default_csid;
                v_lang_context  := dbms_lob.default_lang_ctx;
                v_warning       := null;
                DBMS_LOB.CREATETEMPORARY(v_file_blob_new,true);
                dbms_lob.convertToBlob(
                        v_file_blob_new,
                        v_file_clob,
                        v_file_size,
                        v_dest_offset,
                        v_src_offset,
                        v_blob_csid,
                        v_lang_context,
                        v_warning);
                IF v_warning = 0 THEN
                   RETURN v_file_blob_new;
                END IF;  
        END IF;
END;
END PCODE;
/Thanks
Nitin
Edited by: user13048604 on Jan 12, 2011 10:18 PM

First you may need to convert 'BLOB' which is of 'RAW' type to 'VARCHAR2'
using
utl_raw.cast_to_varchar2(urblob)Then you can make use of dbms_lob.instr,dbms_lob.substr etc...

Similar Messages

  • Insert from Long Raw to Blob

    Hi all,
    I'm presently working on oracle 8.1.7,im having a table with Long Raw as a field.
    I want to insert the image into another table which containing a Blob as field.I wanted it to take place either by Database trigger or Procedure or any other way..
    Please can anybody provide me the script. I've already tried the procedure..select long raw to blob..I'm getting Numeric or Value error...i think the size of the image in the long raw table might be > 32767...
    Urgent please...
    thanks in advance
    rgds,
    John

    Hi John,
    Post this question in Database forum for quick help.
    The forum is present at this location.
    General Database Discussions
    Regards,
    Anupama

  • Xmlgen.getxml Nested Cursors with LONG RAW and BLOB Data Types

    I am trying to use a nested cursor with xmlgen.getxml that has a long raw or blob column. In either case, it will not return to me any data in the xml document pertaining to that LONG RAW or BLOB column. If I do not use a nested cursor, it works fine.
    Example:
    SELECT xmlgen.getxml('SELECT x, CURSOR(SELECT y FROM y_tab WHERE y_tab.x_id = x_tab.x_id) y FROM x_tab') FROM dual;
    This will not produce the information I am after.
    However, simply running:
    SELECT xmlgen.getxml('SELECT y FROM y_tab WHERE y_tab.x_id = <somevalue>') FROM dual;
    Works???
    Any ideas out there? Does anyone know if DBMS_XMLQUERY has this limitation?
    Thanks,
    Brad

    It doesn't appear that I am able to attach the PDF files.  Can you supply your email (or I can supply mine) so I can send you the three files:
    1.)  A good PDF (manually extracted from our old application)
    2.)  Dump of the same PDF file (includes header/footer info)
    3.)  A partially fixed PDF file (but some of the pictures / pages are cut off - specifically pages 3,5,9,10,12,14)
    The way that we have tried to fix the file (in example 3 above) is the following:
    a.)  Find the First Occurrence of "%PDF-"
    b.)  Find the Last Occurrence of "%%EOF"
    c.)  if the first "%PDF-" is found AND the last "%%EOF" is found, then
       i.)  Remove all data before the first %PDF-
       ii.)  Remove all data after the last %%EOF
    Let me know if you need any other information.
    Thanks,
    Mike

  • Limitation of converting from Long Raw to Blob

    Hi All,
    DB:11g
    Oracle Apps:R12
    Is there a limitation of converting from Long Raw to Blob?
    Please share your experience on this subject in case anyone has faced it before.
    Thanks for your time!
    Regards,

    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:13213885403654
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:510622111991

  • Migrating LONG RAW to BLOB and optimizing extent size

    Hi all,
    I got a quite fragmented table with a LONG RAW column I want to migrate to BLOB and defragment.
    DB version is Oracle9i Release 9.2.0.4.0 and this is a production environment.
    I know MOVE and/or CTAS are not possible with LONG RAW columns
    So, how can I do that? Is ALTER TABLE MODIFY the only possibility to migrate from LOING RAW to BLOB?
    Since ALTER TABLE MODIFY will lock the whole table preventing any DML operation, I need at least a rough estimate of the time needed for this operation. How can I do that?
    Since this table is quite fragmented, I also want to rebuilt it using a different extent size.
    I think I should issue a ALTER TABLE MOVE... after having performed the "ALTER TABLE MODIFY".
    Can I do something better to minimize unavailability to DML operations?
    thanks,
    andrea

    Hi,
    Is this an OCCI question?
    I don't see that "to_blob" is documented anywhere. The "to_lob" function can be used to convert long raw columns, but its use is pretty specific and certainly not for general query use.
    Regards,
    Mark
    EDIT1: Well, my local documentation set does not have "to_blob" in it at all. However, it is in the 11.1 SQL Language Reference on OTN:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/functions186.htm#sthref2358
    Despite the fact that the documentation mentions "long raw" the function appears to only work with "raw" data in my 11.1 tests.
    What's your goal here?
    Edited by: Mark Williams on Jun 8, 2009 7:15 PM

  • Long raw to blob

    Hi
    I am working on Pl/Sql scrpit to transfer data/images from one Oracle 8i DB to another.
    The images to be transfered are in Long Raw but need to populate a column in BLOB.
    Any ideas how to convert?

    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:13213885403654

  • Modify long raw to blob column

    Hello,
    I would like to know if it is possible to modify a long raw column into a blob column, without having to drop and recreate my table.
    There is already data inserted in the long raw column.
    Thanks in advance,
    Cindy

    'Fraid not.
    A LOB is stored "out-of-line", which means the actual "raw" data is held separately from the table. A long raw stores the data in-line. This means that you'll have to write some code to extract the "raw" data and write it to the LOB. Methinks you won't be able to add a LOB-type column to the table if you have a long raw existing in it already.

  • Converstion Long raw to BLOB

    Hello All,
    I am using Oracle 10g,
    I need to alter a table which have a Long row data type column, i want to modify the data type of this column to BLOB.
    This table contains data, does this alteration affect the data of the table in any way?
    Regards,

    Any information ? if the alteration of the LONG RAW data type to BLOB affect the existing data ?
    Thanks in advance ,

  • Jdbc session - LONG RAW or BLOB ?

    Hello,
              My over-large session data cannot use the LONG RAW data type, for session data field. I think that is a jdbc driver limitation.
              Session data does not appear to be saved at all if I use a 'BLOB' instead of LONG RAW. Does anyone know if this usually works ?
              The drivers I have tried are -
              oracle.jdbc.driver.OracleDriver
              weblogic.jdbc.oci.Driver
              Oracle 817
              Weblogic 6.1 sp 3
              thanks in advance,
              John
              

    Kiran,
    A long raw column can store up to 2 Go and you can have only one by table.
    With 9i, BLOB column can store up to 4Go and you can have as so many you want.
    With 10g, BLOB column can store up to 8To
    I suggest you to use BLOB columns.
    Francois

  • Long Raw vs Blob

    We have a table in our database which contains the following field types:
    CREATE TABLE TESTBLOB (
    A NUMBER ( 10 ) NOT NULL ,
    B VARCHAR2 ( 765 ) DEFAULT '' ,
    C NUMBER ( 10 ) DEFAULT 0 ,
    D NUMBER ( 10 ) DEFAULT 0 ,
    E NUMBER ( 10 ) DEFAULT 0 ,
    F NUMBER ( 10 ) DEFAULT 0 ,
    G NUMBER ( 5 ) NOT NULL ,
    H NUMBER ( 5 ) NOT NULL ,
    I NUMBER ( 5 ) NOT NULL ,
    J NUMBER ( 5 ) NOT NULL ,
    K NUMBER ( 10 ) DEFAULT 0 ,
    L LONG RAW DEFAULT NULL ,
    CONSTRAINT PK_TESTBLOB PRIMARY KEY ( A )
    We recently changed B to VARCHAR2 (2000). After that change, the bitmap images we were saving as A LONG RAW would be loaded back into our application with the right half on the left side and the left side on the right. When we changed L to be a BLOB, the bitmap images are being loaded back into the application correctly and this issue has been corrected.
    I guess my questions are, can anyone tell me what making these changes did to the database and why does changing the LONG RAW to a BLOB resolve the issue?
    Thanks in advance.

    The misdisplay of the data when it was stored as a long raw sounds like an application issue. Either the data was being stored or retrieved wrong (or both).
    Changing the code to work with a BLOB corrected the error.
    Long raws are an obsolete data type provided for backward compatibility only so using a BLOB is a better choice for future maintainability of your code.
    Note the BLOB will be stored out of line, that is, in a separate LOB table and an object id will be stored in the base table row that points to the the LOB row.
    You can find more information of the datatype in the Concepts manual chapter on data types or the Application Developers Fundamentals Guide.
    HTH -- Mark D Powell --

  • BLOB-LONG RAW

    Can you give e some guidance on behaviour of LONG RAW and
    BLOB with ODBC. In my application I am using a BLOB field but ODBC is not
    allowing me to insert more than 4k binary data. Then I used LONG RAW for
    that field but now its not working properly. If you know SQLGetData is an
    ODBC API used. It is behaving differently for LONG RAW& BLOB which I thnk
    is root cause. If anyone out there could help me, I will be really obliged.
    1) How to insert more than 4k in BLOB using ODBC (driver which comes with
    Oracle 8i Enterprise edition)
    2) Difference in behaviiour of ODBC SQLGetData for BLOB & LONG RAW

    Hi,
    thx for your answer.
    That's the solution I described (INSERT, SELECT, UPDATE) and only works with Statements.
    But I think I've already found a mistake of mine, I have to try this today.
    I already succeeded in creating a BLOB-Object without obtaining it from a resultset, the constructor is not documented but it exists, it looks like BLOB( OracleConnection, byte[] ).
    I think I can commit the BLOB to the stored procedure but it won't be a valid BLOB locator.
    What I've not tried yet and what I think migth be the solution is creating the valid BLOB locator inside the stored procedure using the PL/SQL BLOB methods.
    Sounds simple but for some reasons I have not thougth about it yet. :-)
    I'll report the result here if somebody else is interested in the issue. :o)
    Thx and regards,
    Robert

  • How can i get a LONG RAW size? Please help me.

    Hi,
    I have one table (record) that contain 2 fields,
    image as LONG RAW and staffid as string.
    How can i make the select statement to get the actual size for each image?
    I have try to do " Select dbms_lob.getLength(image) as actualsize,staffid from record " ,
    but it get error "ORA-00997:illegal use of LONG datatype"
    Can any body help me ?thanks
    Message was edited by:
    user450549

    LONG RAW and BLOB are very different data types. Oracle has been suggesting for quite a while that folks migrate from LONG RAW to BLOB-- it's much easier to work with BLOB data than LONG RAW data...
    How much data, roughly, do you have in these columns. If it's relatively small, you may be able to use UTL_RAW.LENGTH. If it's longer, though, I believe you have to write a program that reads all the data and calculates the length as you go, which is obviously not particularly efficient...
    Justin

  • Oracle & BLOB/LONG RAW

    Hi everybody,
    I need to store binary data (> 32K) in an oracle BLOB field, respectivly commit the data to an oracle PL/SQL stored procedure.
    First I tried to use LONG RAW, but failed to commit more than 32K of data. This seems to be a documented problem, you can store 2GBs in an LONG RAW field, but PL/SQL can only store 32K in an LONG RAW variable.
    Then I tried to switch from LONG RAW to BLOB (both the field in the table and the in variable in the stored procedure) but it seems to be very complicated to use BLOB fields with JDBC.
    I've found example for a plain INSERT. First execute an INSERT with an empty BLOB, then make an SELECT FOR UPDATE on the row, obtain the reference to the BLOB-Object, alter the BLOB-Object and create an UPDATE-Statement with it.
    I've not tried this yet, but according to various web sites it should work.
    The problem is, that it does not solves the problem how to commit a BLOB value to a PL/SQL stored procedure.
    Does anyone knows a solution?
    Thx and regards,
    Robert

    Hi,
    thx for your answer.
    That's the solution I described (INSERT, SELECT, UPDATE) and only works with Statements.
    But I think I've already found a mistake of mine, I have to try this today.
    I already succeeded in creating a BLOB-Object without obtaining it from a resultset, the constructor is not documented but it exists, it looks like BLOB( OracleConnection, byte[] ).
    I think I can commit the BLOB to the stored procedure but it won't be a valid BLOB locator.
    What I've not tried yet and what I think migth be the solution is creating the valid BLOB locator inside the stored procedure using the PL/SQL BLOB methods.
    Sounds simple but for some reasons I have not thougth about it yet. :-)
    I'll report the result here if somebody else is interested in the issue. :o)
    Thx and regards,
    Robert

  • PLSQL 을 사용해서 LONG RAW 를 BLOB 으로 바꾸는 방법

    제품 : PL/SQL
    작성날짜 : 2002-10-16
    PLSQL 을 사용해서 LONG RAW 를 BLOB 으로 바꾸는 방법
    ======================================
    PURPOSE
    PLSQL 을 사용해서 LONG/LONG RAW 를 BLOB/CLOB 으로 바꾸는 방법을
    예제를 통해 알아봅니다.
    만일 Oracle 9i v9.x 를 이용하는 경우에는 다음 명령을 사용하실 수 있습니다.
    ALTER TABLE 'TABLE with LONG column' MODIFY ('LONG column' CLOB)
    또는
    ALTER TABLE 'TABLE with LONG RAW column' MODIFY ('LONG RAW column' BLOB)
    Example
    Example #1
    Example #1 은 LONG column 에 64k 이하의 data 가 있을 경우
    PL/SQL 을 이용해서 BLOB 으로 바꾸는 예제 입니다.
    -- table 을 drop 합니다.
    drop table traw;
    drop table tblob
    -- table 을 생성합니다.
    create table traw (n1 number , l1 long raw);
    create table tblob (n1 number , l1 blob);
    --- clob 도 사용 가능합니다.
    -- table 에 insert 합니다.
    begin
    for i in 1..10 loop
    insert into traw values (i,utl_raw.cast_to_raw(rpad(to_char(i),60,'&')));
    insert into tblob values (i,empty_blob());
    end loop;
    end;
    declare
    lobloc blob;
    buffer long raw(32000);
    amount number ;
    offset number := 1;
    begin
    for rec in (select * from traw) loop
    select l1 into lobloc from tblob where n1=rec.n1 for update;
    buffer := rec.l1;
    amount := utl_raw.length(rec.l1);
    dbms_lob.write(lobloc,utl_raw.length(rec.l1),1,buffer);
    end loop;
    end;
    Example #2
    다음은 PL/SQL 를 이용해서 LONG columns 을 BLOBs 로 변환하는
    또 다른 방법입니다.
    REM long2lob.sql
    REM Version 1.0, last updated 8/8/97
    REM This procedure copies LONG data into a CLOB, as described in
    REM Chapter 21 of Oracle8 PL/SQL Programming by Scott Urman.
    CREATE OR REPLACE PROCEDURE Long2Lob(
    -- Uses DBMS_SQL to select a LONG column identified by p_LongQuery, and
    -- returns it in p_CLob.
    p_LongQuery IN VARCHAR2,
    p_CLob IN OUT CLOB) AS
    c_ChunkSize CONSTANT INTEGER := 100;
    v_CursorID INTEGER;
    v_RC INTEGER;
    v_Chunk VARCHAR2(100);
    v_ChunkLength INTEGER;
    v_Offset INTEGER := 0;
    BEGIN
    -- Open the cursor, define, execute, and fetch.
    v_CursorID := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(v_CursorID, p_LongQuery, DBMS_SQL.V7);
    DBMS_SQL.DEFINE_COLUMN_LONG(v_CursorID, 1);
    v_RC := DBMS_SQL.EXECUTE_AND_FETCH(v_CursorID);
    -- Loop over the LONG, fetching c_ChunkSize characters at a time from
    -- the LONG and adding them to the LOB.
    LOOP
    DBMS_SQL.COLUMN_VALUE_LONG(v_CursorID, 1, c_ChunkSize, v_Offset,
    v_Chunk, v_ChunkLength);
    DBMS_LOB.WRITE(p_CLob, v_ChunkLength, v_Offset + 1, v_Chunk);
    IF v_ChunkLength < c_ChunkSize THEN
    EXIT;
    ELSE
    v_Offset := v_Offset + v_ChunkLength;
    END IF;
    END LOOP;
    DBMS_SQL.CLOSE_CURSOR(v_CursorID);
    EXCEPTION
    WHEN OTHERS THEN
    -- Clean up, and reraise the error.
    DBMS_SQL.CLOSE_CURSOR(v_CursorID);
    RAISE;
    END Long2Lob;
    Reference Documents
    Note:1012454.7
    Note:168975.1

  • ORA-06502 trying to load a long raw into a variable.

    Hi. In my table "banco_imagem" the bim_src column is a long raw type.
    I´m using oracle forms 6 (not 6i), so I can´t use blob type to save my images.
    Now I´m trying to load the long raw column into a variable in a package that runs on 10g.
    I´m trying to execute de folowing code at sql plus:
    declare
    wbim   long raw;
    begin
    select bim_src into wbim from banco_imagem where rownum=1;
    end;
    The column is not null. It has a value.
    I got the folowing error:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at line 4
    My goal is to load this column to convert it to blob so I can manipulate with my others (already running) functions.
    Can anyone help me?
    Thanks!

    Hi Mcardia,
    not sure where you're going wrong, but perhaps if you compare what you've done up to now to the following code snippet, you may figure it out eventually!
    SQL> drop table test_raw
      2  /
    Table dropped.
    SQL>
    SQL> create table test_raw (col_a long raw, col_b blob)
      2  /
    Table created.
    SQL> set serveroutput on
    SQL> declare
      2 
      3    l1 long raw;
      4    l2 long raw;
      5   
      6    b1 blob;
      7   
      8  begin
      9 
    10    l1:= utl_raw.cast_to_raw('This is a test');
    11   
    12    insert into test_raw (col_a) values (l1);
    13 
    14       
    15    select col_a
    16    into   l2
    17    from    test_raw
    18    where   rownum < 2;
    19   
    20    dbms_lob.createtemporary (b1, false);
    21   
    22    dbms_output.put_line(utl_raw.cast_to_varchar2(l2));
    23    b1 := l2;
    24 
    25    update  test_raw set col_b = b1;
    26   
    27    commit;
    28   
    29    dbms_output.put_line('Done ');
    30   
    31    exception
    32      when others then
    33        dbms_output.put_line('Error ' || sqlerrm);
    34  end;
    35  /
    This is a test
    Done
    PL/SQL procedure successfully completed.Bear in mind that I'm running on the following:
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production

Maybe you are looking for

  • Mail attachment generated in UDF in SAP PI 7.1 - Issue with line feed

    Hello, Situation is: Implemented a scenario in SAP PI 7.1 with a mail receiver following this thread: /people/samuel.chandrasekaran2/blog/2008/10/06/xi-mail-adapter-dynamically-building-attachment-and-message-body-content-using-a-simple-udf which is

  • Unable to update iphoto or imovie Apps

    I'm unable to update my iphoto and imovie Apps, after I uptaded to Mavericks OS. I didn't change my Apple ID account and I'm getting the following error: "This update is for an app downloaded with a different Apple ID. Sign in with that Apple ID and

  • Steps for creating a dashboard in desktop and deploying it on an ipad

    Hi All, Can any one tell me the steps to dashboard creation for mobile(i-pad or i-phone) with an example. is it possible in Bi or we should develop it Publisher ? Please clarify me and let me know the creation steps with example'

  • How to insert this css style to table

    Hi, I'm a beginner in web design. I wanted to use a custom separator for my navigation bar. I searched and found this separator: http://front-back.com/pure-css-3-fancy-separator I'm interrested in the vertical-left one. I compiled the scss code to cs

  • PrintStream to the Windows console

    Hi, I'm printing the copyright char � (Unicode u+00A9) to standard output. This works perfectly in Linux using JDK version 1.5.0_01 and 1.4.2_06 and _01, using either of a UTF-8 and a ISO-8859-1 locale. Unfortunately, when I run the same class in Win