Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to change the datatype of an existing column (ie from number to varchar2)

UmashankarsApr 15 2016 — edited Apr 20 2016

Hi All,

I have an requirement, where i need to convert my existing colum datatype to new datatype (ie From number(3) to Varchar(3).

i followed the steps

1. Create a new column A with datatype of varchar2

2. Copying the existing column value to new column A

3. disabling /dropping the constraints on existing colum

4. updating the existing column to null

5. modifying the existing column datatype ( from number to varchar2)

6. copying the values from new column A to existing column

7. dropping the column A

8. enabling the constraints.

But it takes more time in step2 (around 50+ mins )

can you suggest is there any better way to change the column datatype ?

Thanks in advance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 18 2016
Added on Apr 15 2016
16 comments
3,181 views