TSHHAOLIHAI

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;

分类:

技术点:

相关文章:

  • 2022-01-24
  • 2021-10-25
  • 2022-01-27
  • 2021-12-21
  • 2021-12-23
  • 2022-01-18
  • 2022-01-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2022-01-02
  • 2022-02-16
相关资源
相似解决方案