create table temp_uda1 (test1 integer);
insert into temp_uda1 values (1);
alter table temp_uda1 add (test1_new varchar2(3));
update temp_uda1
set test1_new = to_char(test1);
alter table temp_uda1 drop column test1 cascade constraints;
alter table temp_uda1 rename column test1_new to test1;
如果列上有索引,则需要重新创建它。
请注意,如果旧列中的数字大于999,则更新将失败。如果这样做,则需要调整该varchar
列的最大值