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