Xref: alice comp.databases.oracle.misc:22545
Path: alice!news-feed.fnsi.net!news.maxwell.syr.edu!wn4feed!worldnet.att.net!204.127.161.35!attbt2!ip.att.net!news.cat.com!not-for-mail
From: Robin Quasebarth <robinq@data-point.com>
Newsgroups: comp.databases.oracle.misc
Subject: Re: Unique constraints across tables?
Date: Wed, 11 Nov 1998 12:18:50 +0000
Organization: Data Point Solutions  www.data-point.com
Lines: 34
Message-ID: <364980A9.95DD110C@data-point.com>
References: <72cocd$5sc$1@nnrp1.dejanews.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 4.06 [en] (WinNT; I)

 I think you are missing a table that would hold the combined values
(ID,TERMINATION_DATE,and TELNO) as its PK.  If you don't want to populate the new
table then use a trigger to auto-create the record before insert and the trigger
would fail and give appropriate message and action. Then with a PK on that new
table, you could not violate what you are asking for. And if there are to be
children of the combined values, the children should belong to the new table. I
do not know what those tables are accomplishing, but are you sure
TERMINATION_DATE belongs in TABLE1?

swilson669@my-dejanews.com wrote:

> I am trying to find the best way to make two fields in two different tables
> unique together.  I don't think that this can be done in a constraint, and am
> thinking that it should be done in a trigger.  I thought that I would just
> confirm my thoughts before doing this.
>
> The structure looks like this:
>
> TABLE1
> ID PK
> TERMINATION_DATE DATE NULL
>
> TABLE2
> ID FK
> TELNO VARCHAR2 NULL
>
> Telno and Termination_date are to be unique together not separately.
>
> I would appreciate any help, with this. Thanks in advance.
> SWilson
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

