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

Home -> Community -> Usenet -> c.d.o.server -> Re: Changing datatype of columns without dropping associated constraints

Re: Changing datatype of columns without dropping associated constraints

From: Noel <tbal_at_go2.pl>
Date: Fri, 13 Feb 2004 12:55:39 -0000
Message-ID: <c0idp9$60c$1@inews.gazeta.pl>


> I have two tables...P_TYPE and AC_PROJECT

> P_TYPE(table)
> p_type_code varchar2(2) Primary Key --column

> AC_TYPE(table)

> ac_type_code varchar2(2) Primary Key --column
> p_type_code varchar2(2) Foreign Key relation to p_type_code in P_TYPE
table.
>
>
> Now I want to change the datatype of the p_type_code to char(2) in both
the tables
> P_TYPE and AC_TYPE without dropping the constraint.
>
>
> Will disabling the constraint allow me to change the datatype of the
columns?

You didn't mention Oracle version...

No it won't. To change datatype column must be empty. So you need to do a copy of column,
empty it and fill from copy. Since you want to change primary key values you need to add another temporary primary key.

By the way...
Why do you want to change type of column from varchar2(2) to char(2) ????????
Forget it, char datatype might be no longer supported in newer version of oracle,
so leave alone that datatype conversion.

--
Noel
Received on Fri Feb 13 2004 - 06:55:39 CST

Original text of this message

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