oracle中设置主键时总是报出ORA-00904:标识符无效的错误。
--CreatetablecreatetableBRANCH(BRANCHIDNUMBER(4),BRANCHNAMEVARCHAR2(50),BRANCHSHORTNA...
-- Create table
create table BRANCH
(
BRANCHID NUMBER(4),
BRANCHNAME VARCHAR2(50),
BRANCHSHORTNAME VARCHAR2(50),
PRINCIPALUSER VARCHAR2(50) not null,
CONNECTTELNO VARCHAR2(50) not null,
CONNECTMOBILETELNO VARCHAR2(20) not null,
FAXES VARCHAR2(20) not null
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
-- Add comments to the columns
comment on column BRANCH.BRANCHID
is '机构Id';
comment on column BRANCH.BRANCHNAME
is '机构名称';
comment on column BRANCH.BRANCHSHORTNAME
is '简称';
comment on column BRANCH.PRINCIPALUSER
is '负责人姓名';
comment on column BRANCH.CONNECTTELNO
is '联系电话';
comment on column BRANCH.CONNECTMOBILETELNO
is '手机';
comment on column BRANCH.FAXES
is '传真';
这是我的表的sql语句,然后我要把我的BRANCHID设置为主键时报出了ORA-009004:标识符无效的错误,后面还紧跟着这段代码:-- Create/Recreate primary, unique and foreign key constraints
alter table BRANCH
add constraint PB-BRANCHID primary key (BRANCHID); 展开
create table BRANCH
(
BRANCHID NUMBER(4),
BRANCHNAME VARCHAR2(50),
BRANCHSHORTNAME VARCHAR2(50),
PRINCIPALUSER VARCHAR2(50) not null,
CONNECTTELNO VARCHAR2(50) not null,
CONNECTMOBILETELNO VARCHAR2(20) not null,
FAXES VARCHAR2(20) not null
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
-- Add comments to the columns
comment on column BRANCH.BRANCHID
is '机构Id';
comment on column BRANCH.BRANCHNAME
is '机构名称';
comment on column BRANCH.BRANCHSHORTNAME
is '简称';
comment on column BRANCH.PRINCIPALUSER
is '负责人姓名';
comment on column BRANCH.CONNECTTELNO
is '联系电话';
comment on column BRANCH.CONNECTMOBILETELNO
is '手机';
comment on column BRANCH.FAXES
is '传真';
这是我的表的sql语句,然后我要把我的BRANCHID设置为主键时报出了ORA-009004:标识符无效的错误,后面还紧跟着这段代码:-- Create/Recreate primary, unique and foreign key constraints
alter table BRANCH
add constraint PB-BRANCHID primary key (BRANCHID); 展开
1个回答
展开全部
不能用 减号 换成下划线 PB-BRANCHID 换成
PB_BRANCHID
PB_BRANCHID
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询