Oracle中不可以把数据类型转化为object、REF、nested table、VARRAY、 CLOB、BLOB。

表:test_table  

列:test_col  varchar2

直接修改:

Alter table test_table  modify(test_col clob);

将报错:ORA-22858:数据类型的更改无效

上代码:

1 --改名,将要进行类型修改的列改名test_col改为test_col_
2 alter table test_table rename column test_col to test_col_;
3 --用Clob类型建新列,沿用原列名test_col。
4 alter table test_table add (test_col clob);
5 --转移数据,将test_col_复制到test_col
6 update test_table set test_col=test_col_;
7 --commit;
8 --删除原列test_col_
9 alter table test_table drop column test_col_;

 

相关文章:

  • 2021-12-10
  • 2022-12-23
  • 2021-08-07
  • 2021-08-29
  • 2021-09-22
  • 2021-12-01
  • 2022-02-16
  • 2022-12-23
猜你喜欢
  • 2022-01-31
  • 2021-10-30
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案