日期:2014-05-17  浏览次数:22010 次

使用PL/SQL创建数据表时出现缺失右括号和标识符无效的错误,怎么解决?

使用PL/SQL创建数据表时出现缺失右括号和标识符无效的错误

建表语句如下

-- Create table
create table SUBJECT
(
  SUBJECTID NUMBER(20) not null,
  SUBJECT_FID VARCHAR2(20)not null,
  SUBJECTNAME VARCHAR2(50)not null,
  SUBJECTSTATUS VARCHAR2(50) not null,
  SUBJECT_TYPE VARCHAR2(50) 
  SUB_START VARCHAR2(8) not null,
  SUB_END VARCHAR2(8) not null,
  SUBJECT_REMARK VARCHAR2(100) 
 )
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
  initial 64
  minextents 1
  maxextents unlimited
  );
-- Add comments to the columns 
comment on column SUBJECT.SUBJECTID
  is '科目编码';
comment on column SUBJECT.SUBJECT_FID
  is '父级科目编码';
comment on column SUBJECT.SUBJECTNAME
  is '科目名称';
comment on column SUBJECT.SUBJECTSTATUE
  is '科目状态';
comment on column SUBJECT.SUBJECTTYPE
  is '科目类型';
comment on column SUBJECT.YEAR_START
  is '(年度)开始';
comment on column SUBJECT.YEAR_END
  is '(年度)结束';
comment on column SUBJECT.SUBJECT_REMARK
  is '备注';
-- Create/Recreate primary, unique and foreign key constraints 
alter table SUBJECT
  add constraint SUBJECT primary key (SUBJECTID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
  initial 64K
  minextents 1
  maxextents unlimited
  );

首先提示的是在SUB_START处缺失右括号,然后是ORA-00904::"字段名称":标识符无效。不可能每个标识符都无效把

------解决方案--------------------
SUBJECT_TYPE VARCHAR2(50) 
后面缺少个逗号