Oracle 修改字段(varchar2-->clob)

本来该字段使用varchar2(4000),但还是长度不够,需要修改字段类型为clob

1.开始尝试直接把varchar2修改为clob
alter table coupontype modify USE_STORE_CODE clob;

提示:数据类型变更无效

2.先新建clob类型的字段,把原字段的值插入到新建字段中,然后删除原字段,重命名新字段
--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;

猜你喜欢

转载自www.cnblogs.com/TSHHAOLIHAI/p/11293987.html