在修改表字段的NUMBER类型的精度或刻度时,你可能会遇到ORA-01440: column to be modified must be empty to decrease precision or scale,下面介绍一下,如何处理这个问题。测试案例如下:
SQL> drop table test;
Table dropped.
SQL>create table test(product_id number, price number(38,1));
Table created.
SQL> insert into test
2 select 1001, 18.2 from dual union all
3 select 1002, 38.5 from dual union all
4 select 1003, 34.8 from dual union all
5 select 1004, 87.4 from dual;
4 rows created.
SQL> commit;
Commit complete.
SQL> alter table test modify price number(38,2);
alter table test modify price number(38,2)
*
ERROR at line 1:
ORA-01440: column to be modified must be empty to decrease precision or scale
SQL>