I need to increase the size of a column that is used as a primary key. What is the best way to perform this?
The ALTER TABLE command can modify the column's width. If you are increasing the column's size, then you won't run into problems. Decreasing the column's size can be difficult if any row in the table contains a value in the column larger than the size you are trying to shrink to.
The following command should give you an idea how easy it is to increase the column's size (assume the original size was 20 characters):
ALTER TABLE my_table MODIFY (my_column VARCHAR2(30));Your column being the Primary Key for the table will not have any bearing on this operation.
For More Information
- Dozens more answers to tough Oracle questions from Brian Peasland are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our PL/SQL, database administration and data warehousing gurus are waiting to answer your toughest questions.
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.