创建表时弹出错误

时间:2017-01-03 10:44:54

标签: oracle

创建此表时出现错误,您能否提供帮助:

CREATE TABLE FIPR_MASTER ( 
   FIPR_Id   INT NOT NULL GENERATED ALWAYS 
      AS IDENTITY 
      (START WITH 100 
       INCREMENT BY 1 
       MINVALUE 100 
       NO MAXVALUE 
       NO CYCLE 
       NO CACHE 
       ORDER) PRIMARY KEY, 

   FIPR_NAME VARCHAR2(40) NOT NULL, 
   BU_NAME    VARCHAR2(40) NOT NULL, 
   LOCATION VARCHAR2(40) NOT NULL, 
   RECORD_SOURCE_NAME   VARCHAR2(200) NOT NULL, 
   PRIORITY_QUEUE  VARCHAR2(40) NOT NULL, 
   STATUS  VARCHAR2(40) NOT NULL,
   INDEXING_TYPE VARCHAR2(40) NOT NULL,
   SOURCE_PATH  VARCHAR2(200) NOT NULL,
   DESTINATION_PATH  VARCHAR2(200) NOT NULL,
   COMMENTS VARCHAR2(200) NOT NULL
   )

错误:

CREATE TABLE FIPR_MASTER ( 
   FIPR_Id   INT NOT NULL GENERATED ALWAYS 
      AS IDENTITY 
      (START WITH 100 
       INCREMENT BY 1 
       MINVALUE 100 
       NO MAXVALUE 
       NO CYCLE 
       NO CACHE 
       ORDER) , 

   FIPR_NAME VARCHAR2(40) NOT NULL, 
   BU_NAME    VARCHAR2(40) NOT NULL, 
   LOCATION VARCHAR2(40) NOT NULL, 
   RECORD_SOURCE_NAME   VARCHAR2(200) NOT NULL, 
   PRIORITY_QUEUE  VARCHAR2(40) NOT NULL, 
   STATUS  VARCHAR2(40) NOT NULL,
   INDEXING_TYPE VARCHAR2(40) NOT NULL,
   SOURCE_PATH  VARCHAR2(200) NOT NULL,
   DESTINATION_PATH  VARCHAR2(200) NOT NULL,
   COMMENTS VARCHAR2(200) NOT NULL, PRIMARY KEY(FIPR_Id)
   )
Error report -
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 -  "missing right parenthesis"
*Cause:    
*Action:

1 个答案:

答案 0 :(得分:2)

您的DDL声明存在一些问题:

  1. 必须在任何内联约束(not null计为内联约束)之前声明标识列。
  2. 当您将此声明为主键(其中一个定义是pk列不为空)时,无需显式声明not null
  3. NO和MAXVALUE,CYCLE和CACHE之间应该没有间隙。
  4. 以下陈述适用于您,假设您在12.1或以上:

    CREATE TABLE FIPR_MASTER ( 
       FIPR_Id   INT GENERATED ALWAYS 
          AS IDENTITY 
          (START WITH 100 
           INCREMENT BY 1 
           MINVALUE 100 
           NOMAXVALUE 
           NOCYCLE 
           NOCACHE 
           ORDER) PRIMARY KEY, 
    
       FIPR_NAME VARCHAR2(40) NOT NULL, 
       BU_NAME    VARCHAR2(40) NOT NULL, 
       LOCATION VARCHAR2(40) NOT NULL, 
       RECORD_SOURCE_NAME   VARCHAR2(200) NOT NULL, 
       PRIORITY_QUEUE  VARCHAR2(40) NOT NULL, 
       STATUS  VARCHAR2(40) NOT NULL,
       INDEXING_TYPE VARCHAR2(40) NOT NULL,
       SOURCE_PATH  VARCHAR2(200) NOT NULL,
       DESTINATION_PATH  VARCHAR2(200) NOT NULL,
       COMMENTS VARCHAR2(200) NOT NULL
       );