ora-00906:创建表时缺少左括号

时间:2018-03-17 10:33:40

标签: oracle ddl

我正在使用oracle pl.sql开发人员。我有两个模式,我想从另一个模式中的一个模式创建一个表。我使用dbms_metadata.getddl()来检索create table脚本。但是,当我在另一个模式中运行该脚本时,我得到ORA-00906L缺少左括号错误。代码如下:

  CREATE TABLE "DWH"."IBS_S_DOCUMENT_1" OF "DWH"."IBS_S_DOCUMENT_T_1"
 (
   CONSTRAINT "XPK_S_DOCUMENT" PRIMARY KEY ("CODE")
  USING INDEX (CREATE UNIQUE INDEX "DWH"."XPK_S_DOCUMENT" ON "DWH"."IBS_S_DOCUMENT_1"
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "DWH_INDEX" )  ENABLE,
   CONSTRAINT "HSYS_005480" CHECK (DATE_ACTIV IS NOT NULL) ENABLE,
   CONSTRAINT "HSYS_005481" CHECK (DATE_CORRECT IS NOT NULL) ENABLE,
   CONSTRAINT "HSYS_005482" CHECK (CORRECTURE IS NOT NULL) ENABLE,
   CONSTRAINT "HSYS_005483" CHECK (Correcture IN ('A', 'C', 'D', 'T', 'U')) ENABLE
  ) OBJECT IDENTIFIER IS PRIMARY KEY
   PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
 NOCOMPRESS LOGGING
  STORAGE(
    INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "DWH_DATA"
 NESTED TABLE "IBS_S_DOCUMENT_1_H" STORE AS "IBS_S_DOCUMENT_1_HIS"
 (( PRIMARY KEY ("NESTED_TABLE_ID", "DATE_ACTIV") ENABLE)
 ORGANIZATION INDEX PCTTHRESHOLD 50
 NOCOMPRESS PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING
  STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "DWH_INDEX" ) RETURN AS VALUE

IBS_S_DOCUMENT_T_1类型如下:

   CREATE OR REPLACE TYPE "IBS_S_DOCUMENT_T_1"                                          as object (
  CODE                           VarChar2(2),
  NAME                           IBS_S_DOCUMENT_1_NVT,
  DATE_ACTIV                     DATE,
  DATE_DEACT                     DATE,
  DATE_CORRECT                   DATE,
  CORRECTURE                     VarChar2(1),
  CONDITION                      VarChar2(1),
  IBS_S_DOCUMENT_1_H                   IBS_S_DOCUMENT_1_NT
);

为什么我会收到ora-00906错误?有人可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

只需在div之后删除此部分(CREATE UNIQUE INDEX "DWH"."XPK_S_DOCUMENT" ON "DWH"."IBS_S_DOCUMENT_1",然后在第一个USING INDEX之前删除),然后就可以了:

ENABLE

无需对已使用给定名称 CREATE TABLE "DWH"."IBS_S_DOCUMENT_1" OF "DWH"."IBS_S_DOCUMENT_T_1" ( CONSTRAINT "XPK_S_DOCUMENT" PRIMARY KEY ("CODE") USING INDEX --(CREATE UNIQUE INDEX "DWH"."XPK_S_DOCUMENT" ON "DWH"."IBS_S_DOCUMENT_1" PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DWH_INDEX" --) ENABLE, CONSTRAINT "HSYS_005480" CHECK (DATE_ACTIV IS NOT NULL) ENABLE, CONSTRAINT "HSYS_005481" CHECK (DATE_CORRECT IS NOT NULL) ENABLE, CONSTRAINT "HSYS_005482" CHECK (CORRECTURE IS NOT NULL) ENABLE, CONSTRAINT "HSYS_005483" CHECK (Correcture IN ('A', 'C', 'D', 'T', 'U')) ENABLE ) OBJECT IDENTIFIER IS PRIMARY KEY PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE( INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DWH_DATA" NESTED TABLE "IBS_S_DOCUMENT_1_H" STORE AS "IBS_S_DOCUMENT_1_HIS" (( PRIMARY KEY ("NESTED_TABLE_ID", "DATE_ACTIV") ENABLE) ORGANIZATION INDEX PCTTHRESHOLD 50 NOCOMPRESS PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DWH_INDEX" ) RETURN AS VALUE 创建的CREATE UNIQUE INDEX表达PRIMARY KEY