Is it possible to use a CHECK constraint to prevent any date that falls on a Sunday? I don’t want to use a trigger.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, a check constraint can check that the day of the week is not Sunday. Here’s an example:
–There are blank spaces to the right of SUNDAY so like or rtrim is needed to match the string.
When you try to insert a date that is on a Sunday, it will say:
ORA-02290: check constraint (SYS.DAY_IS_NOT_SUNDAY) violated