Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Convert to BLOB?

Re: Convert to BLOB?

From: RC <rclarence_at_tyc.com>
Date: Tue, 28 Dec 1999 17:30:06 GMT
Message-ID: <s6hssu1m5k2166@corp.supernews.com>

Sandijs Jercums wrote:
>
>
> Hi!
>
> Can anyone help me? I need to know, how to convert varchar, long, long
> raw
> and CLOB to BLOB using PL/SQL (Oracle8 Enterprise Edition Release
> 8.0.5.1.0).
>
> Thanks,
>
> Sandijs
>

You probably dont want to convert varchar2, longs, and CLOB to BLOBs. BLOBs are Binary objects while the other datatypes are basically character strings of various lengths. You may want to convert Varchar2s and Longs to CLOBs and Long Raws to Blobs.

If you do want to convert to Blobs however you can user the DBMS_LOB package in PL/SQL to write BLOBs / CLOBs to the appropriate database columns. Longs / Long Raws are a bit more involved but you can use the following code extracted from Oracle 8 PL/SQL for moving LONGS to LOBS

HTH 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(

  c_ChunkSize CONSTANT INTEGER := 100;

  v_CursorID INTEGER;
  v_RC INTEGER;
  v_Chunk VARCHAR2(100);
  v_ChunkLength INTEGER;
  v_Offset INTEGER := 0;

BEGIN   DBMS_SQL.CLOSE_CURSOR(v_CursorID);
EXCEPTION
  WHEN OTHERS THEN

RC

--
Posted via CNET Help.com
http://www.help.com/ Received on Tue Dec 28 1999 - 11:30:06 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US