FK-like constraint referencing union of external tables?

From: <mh_at_pixar.com>
Date: 21 Aug 2009 01:33:52 GMT
Message-ID: <4a8df97f$0$463$366e932_at_news.usenetserver.com>



I have a situation which (simplified) looks like this:

Table UNITS has a PK on UNITS.NAME. (unit name, varchar(12)) Table DEPTS has a PK on DEPTS.NAME. (dept name, varchar(12))

I want to create a table with column UNIT_NAME_OR_DEPT_NAME, with the requirement that data in this column must be either a valid unit name or a valid department name.

I tried adding two FK constraints, but found this gave me the intersection rather than the union of the two tables.

     CONSTRAINT FOO_FK1 FOREIGN KEY(NAME) REFERENCES UNITS(NAME) ENABLE, 
     CONSTRAINT FOO_FK2 FOREIGN KEY(NAME) REFERENCES DEPTS(NAME) ENABLE, 

How can I create a FK or other constraint that would me to reference the union of two tables?

Many TIA!!
Mark

-- 
Mark Harrison
Pixar Animation Studios
Received on Thu Aug 20 2009 - 20:33:52 CDT

Original text of this message