为什么我不能添加让用户输入以特定地址结尾的电子邮件的检查约束

Why can I not add a check constraint that makes the user enter an email ending in a specific address

实施:员工电子邮件地址应使用公司域。那就是 电子邮件地址应以 'abcco.com'.

结尾
alter table employee
add constraint emp_email_check check (co_email in ('%abcco.com'));

但是我收到这个错误

ORA-02293: cannot validate (ITAM.EMP_EMAIL_CHECK) - 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

IN() 谓词仅测试精确字符串匹配。不支持通配符。

你应该使用

check (co_email like '%abcco.com')

或者:

check (left(co_email, 9) = 'abcco.com')