Oracle 中把列的数据类型转化为Clob
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_;

浙公网安备 33010602011771号