Lets say I have two columns of type NUMBER
(without precision, and scale) and VARCHAR(300)
. I saw that these columns are way too large for my data, so I want to modify them to NUMBER(11)
and VARCHAR(10)
. So If I run this SQL statement:
ALTER TABLE FOO
MODIFY(BAR NUMBER(10));
- Will I be able to do that on nonempty column?
- If so, what If there is one value greater than
NUMBER(10)
, will oracle tell me about it? - Will column default values remain unchanged if previously defined?
- Will column nullable option remain unchanged?
- Will primary, foreign, unique key on that column remain unchanged?
- Will constraints involving that columns remain unchanged?
- Will indexes on that columns remain unchanged?
Is there any official documentation answering my questions?
Best Answer
The Oracle Administrators Guide says the following:
The Oracle SQL Language Reference has much more detail including the following:
There is additional information and restrictions in the above documentation. Here is a demonstration of attempting to reduce the precision of a Number column and reduce the length of a Varchar2. You can try other changes so you will know what will happen.
The alter statements have the following output:
Reduce precision by creating a new column.