Q
Problem solve Get help with specific problems with your technologies, process and projects.

Changing datatype of one column

I have an Oracle table with 8 million records. I need to change the datatype associated with one of the columns. What would be the best process for doing this? I am a .NET developer and do not know exactly how to approach this.

I have an Oracle table with 8 million records. I need to change the datatype associated with one of the columns. What would be the best process for doing this? I am a .NET developer and do not know exactly how to approach this, and our DBAs will only run scripts that have been written and supplied to them. Thanks.
To change the datatype, it may be as simple as issuing a command similar to the following:
ALTER TABLE my_table MODIFY (my_column new_datatype);

You should issue the command when no one is using the table as it will lock users from modifying the table's contents until the command completes. In order for the above command to succeed, the data in the column must not violate the new datatype. For instance, you will not be able to convert from VARCHAR2 to NUMBER unless the column only contains numbers in character form. If there are characters, the above will generate an error.

Your DBA should be willing to help you with this, even if it is your responsiblity to write the script. If your DBA is not willing to help you, then I would recommend talking with management as they may not be doing thier job.

Dig Deeper on Oracle database design and architecture

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close