Search code examples
oracle-databaseforeign-keysddlcreate-table

DECLARE A FOREIGN KEY CONSTRAINT causes ORA-00907


I have a create table statement, but it's not compile, The fk_myFirstTable CONSTRAINT cause the problem. Someone know what wrong in the CONSTRAINT ?

I get : ORA-00907: - "missing right parenthesis"

  CREATE TABLE "mySchema"."mySecondTable " 
   (    
   idNumber NUMBER(10,0)  NOT NULL ENABLE, 
   SystemId  NUMBER(10,0) NOT NULL ENABLE, 
   CONSTRAINT "mySecondTable _PK" PRIMARY KEY (idNumber ),
   CONSTRAINT "fk_myFirstTable" FOREIGN KEY (SystemId) REFERENCES myFirstTable(SystemId) 
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  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 "MYTBS"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  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 "MYTBS" ;

thanks for help!


Solution

  • I have a stupid space in the declare line:

    CREATE TABLE "mySchema"."mySecondTable " 
    

    instead of:

    CREATE TABLE "mySchema"."mySecondTable" 
    

    Sorry for the lack of attention!