Search code examples
oracle-databaseoracle11gconstraintsddl

ORA-00907: missing right parenthesis, What could be the problem?


I try to add a constraint , but it gave me the error

ORA-00907: missing right parenthesis

What could be the problem?

CREATE TABLE "BDCOMEARE"."PILOTE" (
  "matrPlt" INTEGER NOT NULL ,
  "nomPlt" VARCHAR2(50) ,
  "prenomPlt" VARCHAR2(50) ,
  "gradePlt" VARCHAR2(100) ,
  "adressePlt" VARCHAR2(100) ,
  "salairePlt" NUMBER(10,2) ,
  "dateEmbauche" DATE ,
  PRIMARY KEY ("matrPlt")
)

ALTER TABLE PILOTE ADD CONSTRAINT check_gradePlt
    CHECK (gradePlt IN 'commandantBord', 'assistantBord','officier');

Solution

  • Just that you need brackets after IN clause

    CONSTRAINT check_gradePlt CHECK (
      gradePlt IN ('commandantBord', 'assistantBord', 'officier')
    );