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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Convert NUMBER to VARCHAR2

Re: Convert NUMBER to VARCHAR2

From: <rock_cogar_at_my-deja.com>
Date: Wed, 24 Nov 1999 13:28:26 GMT
Message-ID: <81gp5m$o4c$1@nnrp1.deja.com>


There are probably dozens of ways to solve this problem. Here is how I do this kind of thing:

  1. ALTER TABLE foobar ADD ( foo varchar2(64));
  2. Write a PL/SQL script to cursor loop through the table to:
  3. Convert the number column to character using to_char()
  4. Update each row of the table with the new value into column foo

Rock Cogar.
Radian International LLC.
Oak Ridge, TN. USA.

In article <81g9j9$s4f$1_at_mark.ucdavis.edu>,   tndoan_at_abondigas.engr.ucdavis.edu (Tin Ngoc Doan) wrote:
> Hi all,
>
> Here is my situation. I've a multi-column table with data, and one
of
> the columns is a NUMBER type. I need to convert it to VARCHAR2()
type.
>
> What is the best way to do this?
>
> Unlike MySQL, Oracle does not handle all the copying in the background
> using the ALTER TABLE command.
>
> Appreciate your help,
> Tin
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Nov 24 1999 - 07:28:26 CST

Original text of this message

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