SQL Check Constraint cannot reference other column
- by user1777711
I trying to add this sql check in
ALTER TABLE School
add Role check_role
CHECK (check_role IN ('Teaching Assistant', 'Lecturer', 'Professor'));
I get the error below
ERROR at line 3:
ORA-02438: Column check constraint cannot reference other columns
SQL> desc School;
Name Null? Type
----------------------------------------- -------- ----------------------------
STAFFNUM NOT NULL VARCHAR2(12)
NAME NOT NULL VARCHAR2(50)
ADDRESS NOT NULL VARCHAR2(300)
DOB DATE
I am trying add a column call Role, with the check constraint check_role
I am using Oracle SQL.
Thanks for all help!