Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: converting from LONG type?
In article <8hp6f7$msc$1_at_nnrp1.deja.com>,
chad_at_pengar.com wrote:
> Hi. I have been asked to work with some data in an
> Oracle database. For some lame reason the data of
> interest is in a LONG datatyped column but all the
> data is short strings that could fit in a VARCHAR2.
> I need to be able to use this in a WHERE clause and
> all sorts of other things that you cannot do on a
> LONG. Is it possible to create a view or copy into
> another table and convert the data from the LONG to
> a VARCHAR2?
>
> Thanks
> Chad
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
if the data would all fit in a varchar2 column, you can:
begin
for x in ( select * from Table_with_long ) loop
insert into another_table ( x.c1, x.c2, x.long_column );
end loop;
end;
/
or, you can use the sqlplus copy command -- see http://osi.oracle.com/~tkyte/Misc/MoveLongs.html
for syntax on that.
-- Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries Howtos and such: http://osi.oracle.com/~tkyte/index.html Oracle Magazine: http://www.oracle.com/oramag Opinions are mine and do not necessarily reflect those of Oracle Corp Sent via Deja.com http://www.deja.com/ Before you buy.Received on Fri Jun 09 2000 - 00:00:00 CDT