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: Converting CHAR to VARCHAR2

Re: Converting CHAR to VARCHAR2

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 7 Feb 2005 01:51:34 -0800
Message-ID: <1107769894.882826.175170@l41g2000cwc.googlegroups.com>

Zephyr wrote:
> Hi,
>
> I've inherited a database schema of Oracle 9i with some
> char columns that can't be used from a GUI interface.
>
> I need to convert these columns from char (5) to varchar2 (5).
> OK, i can drop the constraints create new tables with the rigth
> datatype, insert the tuples ... correct the old table and
erverything back.
>
> Is there a possible other solution the convert the datatypes in an
easy way.
>
> Thanks
> Patrick

  1. Drop indexes.
  2. alter table table_name modify (column_name varchar2(5));
  3. Remove right padding from the values that were created by char. update table_name set column_name = rtrim(column_name);
  4. Recreate indexes.

Regards
/Rauf Received on Mon Feb 07 2005 - 03:51:34 CST

Original text of this message

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