注册

如何把blob字段修改为clob字段?

TT 2023/08/15 1087 5 已解决

需求是把blob字段修改为clob,扩容一下
我试过,直接修改,会报错,

ALTER TABLE "MASTER"."ent_mazl_distribute_context" MODIFY "content" clob;
执行失败(语句1)
-6160: 第1 行附近出现错误:
数据类型的变更无效

于是无奈之下我准备使用改列名,新增列,赋值,删旧列的方式
但赋值时也会报错。

alter table "MASTER"."ent_mazl_distribute_context" rename column content to content_temp;
alter table "MASTER"."ent_mazl_distribute_context" add content clob;
update "MASTER"."ent_mazl_distribute_context" set content=TO_CLOB(content_temp);
alter table "MASTER"."ent_mazl_distribute_context" drop column content_temp;

在第三行update数据时报错,
update "MASTER"."ent_mazl_distribute_context" set content=TO_CLOB(content_temp);
执行失败(语句1)
-6105: 第1 行附近出现错误:
数据类型不匹配
TO_CLOB加不加都会报错

有什么方法吗请问?

回答 0
暂无回答
扫一扫
联系客服