Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Unique constraints across tables?

Re: Unique constraints across tables?

From: Robin Quasebarth <robinq_at_data-point.com>
Date: Wed, 11 Nov 1998 12:18:50 +0000
Message-ID: <364980A9.95DD110C@data-point.com>


 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_at_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
Received on Wed Nov 11 1998 - 06:18:50 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US