MySQL Forums
Forum List  »  General

check constraint error
Posted by: Mark Hwang
Date: July 08, 2020 05:18AM

I have a table with a check constraint to check year values. The first digit can be 1 or 2 and the other 3 digits can be any number from 0-9. This is the DDL for it:

CONSTRAINT `ValidBirthYear` CHECK ((`DateOfBirth` like _utf8mb4'[1-2][0-9][0-9][0-9]')),

When I insert with a value like 1983 with or without quotes if gives an error code 3819 check constraint is violated.

Options: ReplyQuote

Written By
check constraint error
July 08, 2020 05:18AM
July 08, 2020 10:50AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.