1 Reply Latest reply on Jan 19, 2004 10:03 PM by 251652

    how to convert clob to blob

    408063
      hi
      tell me some thong how we can convert clob to blob
        • 1. Re: how to convert clob to blob
          251652
          You can use my procedure

          create or replace procedure CLOB2BLOB (p_clob in out nocopy clob, p_blob in out nocopy blob) is
          -- transforming CLOB â BLOB
          l_off number default 1;
          l_amt number default 4096;
          l_offWrite number default 1;
          l_amtWrite number;
          l_str varchar2(4096 char);
          begin
          begin
          loop
          dbms_lob.read ( p_clob, l_amt, l_off, l_str );

          l_amtWrite := utl_raw.length ( utl_raw.cast_to_raw( l_str) );
          dbms_lob.write( p_blob, l_amtWrite, l_offWrite,
          utl_raw.cast_to_raw( l_str ) );

          l_offWrite := l_offWrite + l_amtWrite;

          l_off := l_off + l_amt;
          l_amt := 4096;
          end loop;
          exception
          when no_data_found then
          NULL;
          end;
          end;

          Best regards, Victor