我的表名userdetails
我想在列mob
之后插入一个新location
列。
我尝试使用代码
alter table userdetails
add mob varchar2(10) after location;
但它显示错误
ORA-01735: 无效的 ALTER TABLE 选项
请帮我。
我正在使用oracle10g。
尝试摆脱“之后”
alter table userdetails add ( mob varchar2(10) )
没有“后定位”。语法无效。
您可能会走以下路线:只需将 mob varchar 添加到 userdetails。它将被添加到表格的末尾。你仍然可以查询它。ALTER TABLE userdetails ADD (mob varchar2(10))
要获得所需的表结构:
// 1) rename the table
rename userdetails to userdetails_old;
// 2) recreate the table with your wanted structure
// Note that the selection order decides about the table structure.
create table userdetails
as
select a as a
, b as b
, location as location
, mob as mob
, c as c
from userdetails_old;
// 3) check what you did
desc userdetails;
// 4) before dropping your old table
drop table userdetails_old;