Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Check constraint year format

Jadey_apexMay 8 2020 — edited May 9 2020

Hi All,

I have a table with a column

schoolyear  varchar(20)

Now I want to validate this column by defining a check constraint, which checks if the data being inserted in the column is of the following format yyyy1/yyyy2

I made the following constraint:

ALTER TABLE ept_schooljaar ADD CONSTRAINT schoolyear_chk CHECK (schooljaar = 'yyyy/yyyy');

The problem now is that it doesn't accept the value 2019/2020

Can someone help me with this issue?

Thanx a lot in advance.

Comments
Post Details
Added on May 8 2020
7 comments
762 views