Increasing Accuracy or Scale of a Number Column in Oracle

I have a table with a name AAAwith a column:

ED_RATE NOT NULL NUMBER(26,6) 

I want to increase its length using this operator:

ALTER TABLE ioa_invoice_line MODIFY FIXED_RATE NUMBER(26,15) 

Now, after doing this, I get an error message, please let me know how I can overcome this.

ORA-01440: column to be modified must be empty to reduce accuracy or scale

  1. 00000 — The column to be changed must be empty to reduce accuracy or scale.
+4
source share
4 answers

Oracle (). , NUMBER(26,6), - NUMBER(26,15). , 26 . , , . 6 , - 15 . 9 , , . , .

9 , , . , :

ALTER TABLE ioa_invoice_line MODIFY FIXED_RATE NUMBER(35,15)
                                                      ^^ ^^ add 9 to both

, 38, .

+5

(26,6) 26 , 6 , 20 . (26,15) - , . 11 , .

, NUMBER (35,15).

+1

, ED_DATE. , .

0

, , :

alter table ioa_invoice_line rename column ED_RATE to ED_RATE_TMP;
alter table ioa_invoice_line add ED_RATE NOT NULL NUMBER(26,15);
update ioa_invoice_line set ED_RATE=ED_RATE_TMP;
alter table ioa_invoice_line drop column ED_RATE_TMP;
execute utl_recomp.recomp_serial();

colum, ED_RATE :

alter table ioa_invoice_line add ED_RATE_TMP NUMBER(26,6);
alter table ioa_invoice_line modify column ED_RATE null;
update ioa_invoice_line set ED_RATE_TMP=ED_RATE, ED_RATE=null;
alter table ioa_invoice_line modify column ED_RATE NUMBER(26,15);
update ioa_invoice_line set ED_RATE=ED_RATE_TMP;
alter table ioa_invoice_line modify column ED_RATE not null;
alter table ioa_invoice_line drop column ED_RATE_TMP;
execute utl_recomp.recomp_serial();
0

Source: https://habr.com/ru/post/1655146/


All Articles