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

一曲冷凌霜 提交于 2019-12-20 07:05:03

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/1715614/setting-up-unique-constraint-on-referenced-columns-in-oracle-10g-xe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!