I already have my tables full of data, I am trying to add a constraint to only allow letters to be entered into the attribute I have named as studentfname. I have tried various different REGEXP but cannot seem to get any to work without getting an error when inserting them.
Im not sure if its a syntax error or what!
Edit: Here is what I have tried and the error I am getting:
ALTER TABLE STUDENT
ADD CONSTRAINT
check_name
CHECK(regexp_like(studentfname,'^[A-Za-z''-]+$'));
Error:
QL Error: ORA-02293: cannot validate (JEIGH7.CHECK_NAME) - check constraint violated
02293. 00000 - "cannot validate (%s.%s) - check constraint violated"
*Cause: an alter table operation tried to validate a check constraint to
populated table that had nocomplying values.
*Action: Obvious
studentfnamecolumn. It doesn't prevent you from having as many additional non-letter characters as you would like.