建表时出错

lamyuu 2006-05-06 01:13:31
create table test(
id int not null;
pid int,
fid int,
primary KEY(id),
KEY pid(pid),
KEY fid(fid)
)
提示说在pid(pid)处缺少右括号

我想问是不是oracle不能在建表时这样建立索引,要建表之后再通过create index column_nam on table_name(column) 才可以?
...全文
154 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
lamyuu 2006-05-29
  • 打赏
  • 举报
回复
id int not null,
结尾应该是逗号,你的是分号,
你的报错应该说的就是这个

-------------------------
我只是写这贴的时候打错了,而且报错是
"KEY pid(pid),
*

ERROR at line 6:
ORA-00907: missing right parenthesis"


magicsign 2006-05-12
  • 打赏
  • 举报
回复
create table test(
id int not null,
pid int,
fid int,
constraint pk_pr primary KEY(id)
);

不过个人认为还是改int为number
LCJ922 2006-05-12
  • 打赏
  • 举报
回复
oracle9I以后可以在建表的时候建立索引,楼主的语法有错误!
fjmingyang 2006-05-11
  • 打赏
  • 举报
回复
id int not null,
结尾应该是逗号,你的是分号,
你的报错应该说的就是这个
-------------------------------
正解
xiaosheng2008 2006-05-11
  • 打赏
  • 举报
回复
id int not null,
结尾应该是逗号,你的是分号,
你的报错应该说的就是这个
tang 2006-05-11
  • 打赏
  • 举报
回复
建表时创建索引,是通过创建主键或唯一约束创建的.
创建主键或唯一约束时自动创建索引.
ferrywong 2006-05-10
  • 打赏
  • 举报
回复
建表的时候可以建索引,但是不是像楼主那样建的。
xiaoxiao1984 2006-05-08
  • 打赏
  • 举报
回复
oracle可以在建表的时候建立索引
create table test (
col1 VARCHAR2(10) not null,
constraint PK_test primary key (col1)
);
tang 2006-05-07
  • 打赏
  • 举报
回复
oracle不能在建表时建立索引
xiaosheng2008 2006-05-06
  • 打赏
  • 举报
回复
是的

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧