oracle调整字段精度的四种方法:
01_执行用户_ddl/dml_表名_注释(建表/授权/同义词)
调整方式一:(精度只能调大不能调小)
alter table table_name_a MODIFY (column_AXX number(27,15));
调整方式二:(借用一个新的列调整)
alter table table_name_a add (column_temp number(27,15));
update table_name_a set column_temp = round(column_AXX,15);
alter table table_name_a drop column column_AXX;
alter table table_name_a add (column_AXX number(27,15));
update table_name_a set column_AXX = column_temp;
alter table table_name_a drop column column_temp;
方式三:(在不影响数据使用的情况下,效率略低)
alter table table_name_a add (column_temp number(30,15));
update table_name_a set column_temp = round(column_AXX,15);
update table_name_a set column_AXX = null;
alter table table_name_a MODIFY (column_AXX number(30,15));
update table_name_a set column_AXX = column_temp;
alter table table_name_a drop column column_temp;
方式四:重新创建一张符合要求的表,通过同义词切换使用(速度最快,效率最优)
user_fu(建表): create table table_name_b;
user_fu(授权): grant select, insert, update, delete on table_name_b to user_zi;
user_fu(copy): INSERT INTO table_name_b SELECT * FROM table_name_a;
user_zi(同义词): create or replace synonym table_name_a for user_fu.table_name_b;