创建测试表
create table t_person(
id varchar2(200) primary key,
name varchar2(200),
address varchar2(200)
);
向测试表中插入数据
insert into t_person(id,name,address) values(sys_guid(),'zhangsan','beijing');
insert into t_person(id,name,address) values(sys_guid(),'lisi','shangqiu');
条件:想把address的varchar2类型改为clob类型
(1)把原字段换个名字,address改为myaddress
alter table t_person rename column address to myaddress;
(2)在表中添加一个原字段名字 address 并把类型定义为自己想改变的类型,这里是clob
alter table t_person add address clob;
(3)
把备份的myaddress字段内容添加到新建字段address中来
update t_person set address = myaddress;
(4)把备份字段myaddress删除
alter table t_person drop column myaddress;