Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Changing datatype of columns without dropping associated constraints
> 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.
-- NoelReceived on Fri Feb 13 2004 - 06:55:39 CST
![]() |
![]() |