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: How can I translate a LONG RAW field INTO a VARCHAR2 one?

Re: How can I translate a LONG RAW field INTO a VARCHAR2 one?

From: <oratune_at_aol.com>
Date: 2000/07/14
Message-ID: <8knaoe$g1i$1@nnrp1.deja.com>#1/1

In article <8kn4nc$32r$1_at_fe2.cs.interbusiness.it>,   "Ema" <carrai_at_eng.it> wrote:
> Hello world!!
>
> ...and sorry for my English.
>
> I need to update a VARCHAR2(4000) field with a LONG ROW one containing
 only
> text.
>
> My database is ORACLE 8.05 and I would like to create a PL/SQL script
 to
> perform this operation. Someone can help me?
>
> Thank you very much...
>
> Emanuele
>
>

This should give you some idea:

declare

    coltxt varchar2(4000); -- place long text here     keyval srctbl.key%type; -- common key between tables     ctr number:= 0;
    cursor get_txt is
    select key, txtcol -- get the long column and the key     from srctbl; -- from the source table begin

    open get_txt;
    loop

        fetch get_txt into keycol, coltxt;
        exit when get_txt%notfound;
        update desttbl           -- table to update
        set txt = coltxt         -- column to update
        where keycol = keyval;   -- common key column in destination tbl
        ctr := ctr + 1;
        if ctr = 100 then
             commit;
             ctr := 0;
        end if;

    end loop;
    commit;
    close get_txt;
end;
/

By selecting the long data into a text column it allows the destination table to be successfully updated.

I hope this helps.

--
David Fitzjarrell
Oracle Certified DBA


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Jul 14 2000 - 00:00:00 CDT

Original text of this message

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