Q: Unique constraint in PL/SQL of date field limited to the year In one table I have an unique constraint over a VARCHAR2 and a DATE field. All works fine!
Now, I just want to consider only (!) the year of the DATE field in my unique constraint.
Are there any opportunities in PL/SQL to do such things?
Thanks for your help!
Kind regards

A: No need for PL/SQL here, just create a unique index on the year:
create unique index unique_year 
  on the_table (the_varchar_column, extract(year from the_date_column));

