Search code examples
oracleconstraintsunique

setting up unique constraint on referenced columns in oracle 10g xe


I have the following situation.

table looks like this

CREATE TABLE CompetitionsLanguages (
  competition REF CompetitionType SCOPE IS Competitions,
  language REF LanguageType SCOPE IS Languages
);

I need this table to have a unique constraint on (competition,language) combination. oracle tells me that i cant put a UNIQUE or PK on columns that reference other tables.

is it possible to somehow avoid the unique, using the CHECK, or some sort of a TRIGGER?


Solution

  • CREATE UNIQUE INDEX unqIndex
        ON CompetitionsLanguages(CompetitionsLanguages, CompetitionsLanguages);