Rick,

One way of doing this is:

Add a new column to the table with a type of Varchar2.
Write a PL/SQL routine to convert the long to a varchar2.  You can do this
simply by assigning the long data type to a varchar2 variable:

create table tomtest(col1 long, col2 varchar2(100));

  1  declare
  2  cursor c1 is select col1,col2 from tomtest;
  3  l_vc varchar2(100);
  4  begin
  5    for c1_rec in c1 loop
  6        l_vc := c1_rec.col1;
  7        update tomtest
  8           set col2 = l_vc;
  9    end loop;
 10* end;

Obviously, you need a better 'where clause' in your PL/SQL.   :)

Another way is to create a new table, and migrate the data using PL/SQL like
above.

Hope this helps.

Tom Mercadante
Oracle Certified Professional


-----Original Message-----
Sent: Friday, August 03, 2001 8:06 AM
To: Multiple recipients of list ORACLE-L


Thanks for the reply but if that is all you have to offer please keep it to
yourself.

-----Original Message-----
Sent: Thursday, August 02, 2001 5:14 PM
To: Multiple recipients of list ORACLE-L


By loosing a gig or two of information.

> -----Original Message-----
> From: Cale, Rick T (Richard) [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 02, 2001 3:04 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Convert LONG to VARCHAR2
> 
> 
> Hi All,
> 
> I know it has been discussed before but can anyone tell me 
> how to convert a
> LONG datatype to VARCHAR2?
> 
> Thanks
> Rick
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> -- 
> Author: Cale, Rick T (Richard)
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California        -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
> 
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Gogala, Mladen
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Cale, Rick T (Richard)
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Mercadante, Thomas F
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to