Ask the Expert

Changing a char address field to varchar

We have an existing production database (recently upgraded to 10g) that has a table with a char(30) address field, and of course now it needs to be lengthened. I'd like to change this to a varchar(100). There are about 300,000 records. What's the best way to go about this?

    Requires Free Membership to View

One simple command should do the trick:
ALTER TABLE my_table MODIFY (my_col VARCHAR2(100));
The biggest concern here is that when the column's value is updated, it may not have enough room in the block to expand should the PCTFREE setting be too low. This can lead to row migration, which can hamper application performance. If you feel your PCTFREE storage parameter is too low for your table, then you might want to reorganize the table.

This was first published in October 2005

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: