I am new at SQLPlus and I want to enforce a CHECK CONSTRAINT on a column that stores names.
I want the constraint to not allow for names to be entered that starts with a Q.
this is what I have:
ALTER TABLE table1 ADD CONSTRAINT table1_name_ck CHECK( name, substr(1,1) ='q');
I am getting the errors:
cannot validate (USER1.TABLE1_NAME_CK) - check constraint violated
AND errors
CHECK( name, substr(1,1) ='q')
*
ERROR at line 2:
ORA-00920: invalid relational operator.
I cannot figure out how to fix these errors or find the correct way to implement this. Any advice would be appreciated! Thanks!. I don't think this code work for lowercase q and uppercase Q but I'm just trying that out for now.