alter table modify number column with data exists
Renga, March 21, 2024 - 11:57 am UTC
suppose column with decimal say (sno number(8,4) and has data. If i want to increase the size (sno varchar2(8,5). Is that possible.
March 25, 2024 - 5:14 am UTC
You can't go from number to varchar2 without reloading the data.
Enlarging number column
mathguy, March 25, 2024 - 6:02 pm UTC
@Renga - I assume you want to enlarge to NUMBER(8,5), not VARCHAR2, right? VARCHAR2 doesn't have two specifiers, only one for length.
If so, the answer to your question is "no, that is not possible" - but perhaps because you didn't ask the question correctly. NUMBER(8,4) means number with eight digits of precision, OF WHICH four are after the decimal point. This means the integer part may be up to four digits. If you (try to) change to NUMBER(8,5), that would still mean eight digits of TOTAL precision, OF WHICH five are after the decimal point. So the number 3282.39 which could fit in NUMBER(8,4) will not fit in NUMBER(8,5) - because NUMBER(8,5) only has room for three digits to the right of the decimal point.
This is a common mistake (at least among beginners). If you want to increase the decimal part to five decimal places, you must increase BOTH the precision AND the scale of the NUMBER column. The proper way to ask the question is whether you can increase from NUMBER(8,4) to NUMBER(9,5). And the answer to that question is "yes, easily, and there are no complications".
March 27, 2024 - 7:12 am UTC
nice input
Mixing up left and right
mathguy, March 27, 2024 - 1:25 pm UTC
Oops - in my earlier reply, I mixed left and right. The end of the second paragraph should be:
NUMBER(8,5) only has room for three digits to the left of the decimal point.
April 02, 2024 - 5:46 am UTC
right
:-)