表中如果有數(shù)據(jù)需要用到下方方式去修改字段類型,無數(shù)據(jù)可直接修改
/*修改原字段名name為name_tmp*/
alter table qdfx_ycsjd rename column yccxds to yccxds_tem;
/*增加一個和原字段名同名的字段name*/
alter table qdfx_ycsjd add yccxds number;
/*將原字段name_tmp數(shù)據(jù)更新到增加的字段name*/
update qdfx_ycsjd set yccxds_tem=trim(yccxds);
/*更新完涛漂,刪除原字段name_tmp*/
alter table qdfx_ycsjd drop column yccxds_tem;