Skip to Main Content

Database Software

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!

Changing all VARCHAR2 columns length semantics from BYTE to CHAR

978225May 22 2014 — edited May 22 2014

Hello,

our DB is using character set AL32UTF8, which is multi-byte.

All our VARCHAR2 columns have been specified as VARCHAR(xxx) without explicit length semantic specification, thus making it VARCHAR(xxx BYTE), because NLS_LENGTH_SEMANTICS is set to "BYTE" (Oracle default).

I am now wondering if it would cause any problems to go in and run ALTER TABLE statements to change all those VARCHAR2(xxx BYTE) columns to VARCHAR2(xxx CHAR), leaving xxx the same. So e.g. a VARCHAR2(100 BYTE) column would be changed to be VARCHAR2(100 CHAR).

If I am not entirely mistaken, this would - if anything - make the columns longer, not shorter; so I would expect to not get any errors about values of existing records being too long to change the column specification that way (like it might happen when shortening a VARCHAR column, e.g. from VARCHAR(10) to VARCHAR(5) ). So I am thinking the ALTER TABLE statements should go through without problems.

I would also change NLS_LENGTH_SEMANTICS to be CHAR.

Are there any problems or implications that I might run into when I do this? I am not worried about implications for external application code or such, but simply integrity / performance / etc on the database level.

This is for an Oracle 11.2.0.x database.

Thanks,

MSA

This post has been answered by Sergiusz Wolicki-Oracle on May 22 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 19 2014
Added on May 22 2014
3 comments
5,995 views