我的表名userdetails
我想在mob
列之后插入新列location
。
我尝试使用代码
alter table userdetails
add mob varchar2(10) after location;
但显示错误
ORA-01735:ALTER TABLE选项无效
请帮帮我。
我正在使用oracle10g。
答案 0 :(得分:4)
尝试摆脱“后”
alter table userdetails add ( mob varchar2(10) )
答案 1 :(得分:1)
在位置"之后没有"。语法无效。
您可以选择以下路线: 只需将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;