修改数据库字段类型或名字

时间:2021-06-04 07:23:24

 ########WF_WORK_FLOW_LOG修改字段类型


1. ##修改原字段名NAME为NAME_TMP

 1 ALTER TABLE WF_WORK_FLOW_LOG RENAME COLUMN WORK_WHOLE_FLOW TO WORK_WHOLE_FLOW_TMP; 

2.##增加一个和原字段名同名的字段NAME

 1 ALTER TABLE WF_WORK_FLOW_LOG ADD WORK_WHOLE_FLOW CLOB; 

3.##将原字段NAME_TMP数据更新到增加的字段NAME

 1 UPDATE WF_WORK_FLOW_LOG SET WORK_WHOLE_FLOW=TRIM(WORK_WHOLE_FLOW_TMP); 

4.##更新完,删除原字段NAME_TMP

 1 ALTER TABLE WF_WORK_FLOW_LOG DROP COLUMN WORK_WHOLE_FLOW_TMP;