在oracle 10g xe中对引用列设置唯一约束 [英] setting up unique constraint on referenced columns in oracle 10g xe
本文介绍了在oracle 10g xe中对引用列设置唯一约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下情况。
表看起来像这样
CREATE TABLE CompetitionsLanguages (
competition REF CompetitionType SCOPE IS Competitions,
language REF LanguageType SCOPE IS Languages
);
我需要此表对(竞争,语言)组合具有唯一约束。
oracle告诉我,我不能在引用其他表的列上放置UNIQUE或PK。
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.
是否有可能通过使用CHECK来避免唯一性,或某种触发器?
is it possible to somehow avoid the unique, using the CHECK, or some sort of a TRIGGER?
推荐答案
CREATE UNIQUE INDEX unqIndex
ON CompetitionsLanguages(CompetitionsLanguages, CompetitionsLanguages);
这篇关于在oracle 10g xe中对引用列设置唯一约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文