Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: easy way to convert a CLOB field to VARCHAR2?
Use the dbms_lob() package to read the clob.
-- Terry Dykstra Canadian Forest Oil Ltd. "Andre Doehn" <a.doehn_at_gmx.net> wrote in message news:9ltv2o$bdmnd$1_at_ID-71421.news.dfncis.de...Received on Tue Aug 21 2001 - 11:24:18 CDT
> dear list,
> what will be the easiest way to convert a CLOB field (with content)
> to an VARCHAR2 (850) field?
>
> 1. drop all constraints of TEST.TBL_1
> 2. rename TEST.TBL_1 to TEST.TBL_2
> 3. create table ... TEST.TBL_1 with a VARCHAR2 (850) field instead of a
CLOB
> field
> 4. import the rows from TEST.TBL_2 in TEST.TBL_1 doesn´t work with:
>
> BEGIN
> FOR rec IN
> (
> SELECT
> CLOB_FIELD
> FROM TEST.TBL_2) LOOP
> INSERT INTO TEST.TBL_1
> (
> VARCHAR2_FIELD
> )
> VALUES
> (
> rec.CLOB_FIELD
> );
> END LOOP;
> END;
>
> ok...this procedure doesn´t work because of type mismatch...
> is there another way to convert this field?
>
> Any way around this?
>
> Andre
>
>