I'm using Oracle 10g. I want to append # to all values in 'sal' column. To acomplish this first I'm trying to change data type of 'sal' column from numeric to varchar but getting following error
![enter image description here](https://i.stack.imgur.com/EPgHL.png)
我究竟做错了什么 ?
你应该使用modify
关键字而不是你的第二个alter
.
alter table
emp
modify
(
sal varchar2(10)
);
修改表列数据类型时,需要使用modify
关键词。
当然,您必须处理现有的列数据。修改表列数据类型时,您可能需要导出行,重新定义表,然后重新导入数据。
在此情况下,您需要按照以下步骤更改列数据类型:
- 在表末尾创建新列。
- 运行更新以填充新表列
- 删除旧表列
- 将新列重命名为原始列名
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)