Bonjour,
Voici le requete de création de ma table ACTIVITE, et en ajoutant une contrainte CHECK, j'ai l'erreur suivante :
Erreur SQL : ORA-02251: subquery not allowed here
02251. 00000 - "subquery not allowed here"
*Cause: Subquery is not allowed here in the statement.
*Action: Remove the subquery from the statement.
Voici l'ordre sql :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
CREATE TABLE Activite (
NomStation  VARCHAR (30) NOT NULL,
Libelle     VARCHAR (20) NOT NULL,
Prix        INTEGER NOT NULL CHECK (Prix > 0 AND Prix < (SELECT Tarif FROM Station WHERE Station.Nom = Activite.NomStation)),  
CONSTRAINT KeyActivite PRIMARY KEY (NomStation,Libelle),
CONSTRAINT KeyForeign  FOREIGN KEY (NomStation) REFERENCES Station (Nom)
);
Je ne sais pas si j'ai loupé quelque chose !!

Merci de votre aide.