Hello people,
I want to create 'Voyageur' table that references a successfully created table which name is 'Categorie',.
But I get this error message when I click on 'run':
ORA-02438: Column check constraint cannot reference other columns
Here is my 'Voyageur' Table that makes me a problem around its foreign key:
CREATE TABLE Voyageur(
numV NUMBER(4) NOT NULL PRIMARY KEY CONSTRAINT check_numV
CHECK(numV LIKE'[!a-zA-Z]') DISABLE,
nomV VARCHAR(15) NOT NULL CONSTRAINT check_nomV
CHECK(nomV LIKE'[!0-9]') DISABLE,
prenomV VARCHAR(15) NOT NULL CONSTRAINT check_prenomV
CHECK(prenomV LIKE'[!0-9]')DISABLE,
birthdayV DATE NOT NULL DISABLE,
addressV VARCHAR(50) NOT NULL DISABLE,
telV VARCHAR(20) NOT NULL CONSTRAINT check_telV
CHECK(telV LIKE'[+]%' AND telM LIKE'[!a-zA-Z]') DISABLE,
idCat NUMBER(1) NOT NULL DISABLE,
FOREIGN KEY(idCat) REFERENCES Categorie(idCat)
);
And here is my 'Categorie' table that works fine:
CREATE TABLE Categorie(
idCat NUMBER(1) NOT NULL DISABLE,
nomCat VARCHAR(20) NOT NULL CONSTRAINT check_nomCat
CHECK(nomCat IN('insulaire','normale','insulairesecondaire')) DISABLE,
reduction NUMBER(3) NOT NULL CONSTRAINT check_reduction
CHECK(reduction IN ( '25' , '50' , '100' )) DISABLE,
PRIMARY KEY(idCat)
);
Any one can help me to resolve this trouble ?
Thank you very much.