Exforsys

Online Training

Want to change the datatype of the column

This is a discussion on Want to change the datatype of the column within the Oracle Database forums, part of the Database category; Hi I have data in a table. I need to change the datatype of a column. say from int to ...


Go Back   Exforsys > Database > Oracle Database

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2007, 06:29 PM
Junior Member
 
Join Date: Jan 2007
Posts: 5
siri6589 is on a distinguished road
Want to change the datatype of the column

Hi

I have data in a table. I need to change the datatype of a column.

say from int to varchar2.

I am working on oracle9i database.

I used alter command but that will work only if the table is empty.

Please can anyone suggest me the solution I would be very much thankful.

Also if i created a temp column is there any command to copy the data from one column to temp column.


Your help would be greatly appreciated.

Thank you very much,
siri6589
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2007, 06:47 PM
Senior Member
 
Join Date: Mar 2005
Posts: 909
techguru is on a distinguished road
Hello Siri,

Step 1: Create a temp column

Step 2 : update table set temp column = old column

Step 3: add new column with desired data type

step 4: drop the old column

step 5 : update table set new column = temp column

Step 6: delete temp column

Let me know how it goes..

Thanks,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-22-2007, 11:44 AM
Junior Member
 
Join Date: Aug 2005
Posts: 11
jyaseena is on a distinguished road
Guru is greate

its a good idea...but I think he is asking a single command ..right?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new questions
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Change Password for SQL Server User admin SQL Server 2005 Tutorials 2 04-07-2006 11:09 AM
*.answers post-approval guidelines *.answers moderation team Tech FAQ 0 06-18-2004 12:45 AM
Solaris x86 FAQ 2/2 Dan Anderson Tech FAQ 0 04-27-2004 07:24 PM
Quarterly ASCII posting of Caldera (SCO) OpenUNIX 8 FAQ Boyd Lynn Gerber Tech FAQ 0 04-25-2004 10:11 PM
Kerberos FAQ, v2.0 (last modified 8/18/2000) Ken Hornstein Tech FAQ 0 04-17-2004 07:28 AM


All times are GMT -4. The time now is 12:16 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.