[sql] alter the size of column in table containing data

Possible Duplicate:
How to make a varchar2 field shorter in Oracle?

In Oracle(9i and above)

 Alter table employee  
 MODIFY ename varchar2(10);

I want to alter the column ename of table employee from varchar2(30) to varchar2(10)

  • Case1 : if the table has data having ename column containing values which are of length less than 10 char(i mean it can fit in varchar2(10) comfortably) - is this allowed by oracle ?

  • Case 2: if the table has data having ename column containing values which are of length greater than 10 char(i mean it can not fit in varchar2(10)) - is this not allowed by oracle ?

This question is related to sql oracle

The answer is


Case 1 : Yes, this works fine.

Case 2 : This will fail with the error ORA-01441 : cannot decrease column length because some value is too big.

Share and enjoy.