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;


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM