Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: How to convert from long to varchar?

RE: How to convert from long to varchar?

From: Shaw, John B <jbshaw_at_ingr.com>
Date: Tue, 5 Dec 2000 10:00:42 -0600
Message-Id: <10701.123667@fatcity.com>


You can't directly, you need to run a pl/sql and pull the data into a cursor and then insert it into a varchar2 or update an cloned table . something like
DECLARE
CURSOR X is SELECT pkey_name,long_col FROM orig ;

 I NUMBER := 0;
 cc number(10);
 dd char(4000);

BEGIN
 open x;
   LOOP
    fetch x into cc,dd ;
    update new_tab set var_column = substr(dd,1,&vsize) where &pkey_name = cc;

              I := I + 1;
     EXIT when x%notfound ;

   END LOOP; .... . .-.. .--. .. ...- . -... . . -. .--. .-. --- -... . -.. John B. Shaw
Intergraph Public Safety
mailstop LR24A4
jbshaw_at_ingr.com
256-730-8038
All the usual disclaimers and some of the certifications

-----Original Message-----
From: Cherie_Machler_at_gelco.com [mailto:Cherie_Machler_at_gelco.com] Sent: Tuesday, December 05, 2000 7:21 AM To: Multiple recipients of list ORACLE-L Subject: How to convert from long to varchar?

We recently migrated from 7.3.4 to 8.1.5. A developer wants me to convert a column in a table that is a long to varchar(255). What is the best way to do this.

Documentation shows changing from
long to LOB but I don't see anything about changing from long to varchar.

Thanks,

Cherie

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author:
  INET: Cherie_Machler_at_gelco.com

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: ListGuru_at_fatcity.com (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). Received on Tue Dec 05 2000 - 10:00:42 CST

Original text of this message

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