Oracle modify the field (varchar2 -> clob)

The field is originally varchar2 (4000), but still insufficient length, it is necessary to modify the field type clob

1. Start attempt to directly modify the varchar2 to clob
alter table coupontype modify USE_STORE_CODE clob;

Tip: Change the data type is invalid

2. The clob first new type of field, the value of the original field are inserted into the new field, and then delete the original field, rename the new field
--1.新建clob类型的字段
alter table coupontype add use_store_code_temp clob;
--2.把原字段的值插入到新建字段中
update coupontype set use_store_code_temp = use_store_code;
--3.删除原字段
alter table coupontype drop column use_store_code;
--4.新字段重命名
alter table coupontype rename column use_store_code_temp to use_store_code;

Guess you like

Origin www.cnblogs.com/TSHHAOLIHAI/p/11293987.html