Home:ALL Converter>foreign key Oracle

foreign key Oracle

Ask Time:2014-10-24T03:13:35         Author:lukas irides

Json Formatter

I'm working with Oracle Database and I have this script :

create table Guardians (
    noCage number(3),
    nomE varchar2(20),
    CONSTRAINT nc_ne1 PRIMARY KEY(noCage, nomE)
);

create table Animals(
    nomA varchar2(20) PRIMARY KEY,
    type varchar2(15) NOT NULL,
    country varchar2(20) NOT NULL,
    noCage number(3), 
    CONSTRAINT fk_anim_cage0 FOREIGN KEY(noCage) REFERENCES Guardians(noCage)
);

Upon executing the script, the table guardians is created, an error is prompted and the table Animals is not created. I did some manipulations and i think that it's got to do with the

CONSTRAINT nc_ne1 PRIMARY KEY(noCage, nomE)

Author:lukas irides,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/26535627/foreign-key-oracle
yy