From: oratune@aol.com
Subject: Re: How can I translate a LONG RAW field INTO a VARCHAR2 one?
Date: 2000/07/14
Message-ID: <8kns25$tqj$1@nnrp1.deja.com>#1/1
References: <8kn4nc$32r$1@fe2.cs.interbusiness.it> <8knaoe$g1i$1@nnrp1.deja.com>
X-Http-Proxy: 1.0 PROXY, 1.0 x63.deja.com:80 (Squid/1.1.22) for client 38.197.71.100
Organization: Deja.com - Before you buy.
X-Article-Creation-Date: Fri Jul 14 20:09:56 2000 GMT
X-MyDeja-Info: XMYDJUIDddf_dba
Newsgroups: comp.databases.oracle.server
X-Http-User-Agent: Mozilla/4.72 [en] (WinNT; I)


In article <8knaoe$g1i$1@nnrp1.deja.com>,
  oratune@aol.com wrote:
> In article <8kn4nc$32r$1@fe2.cs.interbusiness.it>,
>   "Ema" <carrai@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.
>

After re-reading the initial post I am confused -- are you attempting to
insert LONG RAW data into a VARCHAR2(4000) column?  If that is the case
you won't be able to do as you wish, as far as I know.  I have tried and
cannot find a method by which this will work since LONG RAW data is
binary and the hextoraw() and rawtohex() functions won't operate on a
LONG RAW column.  For LONG data the above PL/SQL will work, but not for
LONG RAW.

--
David Fitzjarrell
Oracle Certified DBA


Sent via Deja.com http://www.deja.com/
Before you buy.


