title: Oracle: FK on union of two tables?
body: <p>I have a situation which (simplified) looks like this:</p>
  
  <ul>
  <li>Table UNITS has a PK on UNITS.NAME. (unit name, varchar(12))</li>
  <li><p>Table DEPTS has a PK on DEPTS.NAME. (dept name, varchar(12))</p></li>
  <li><p>I want to create a table with column <code>UNIT_NAME_OR_DEPT_NAME</code>, with the
  requirement that data in this column must be either a valid unit
  name or a valid department name.</p></li>
  </ul>
  
  <p>I tried adding two FK constraints, but found this gave me the
  intersection rather than the union of the two tables.</p>
  
  <pre><code> CONSTRAINT FOO_FK1 FOREIGN KEY(NAME) REFERENCES UNITS(NAME) ENABLE,
   CONSTRAINT FOO_FK2 FOREIGN KEY(NAME) REFERENCES DEPTS(NAME) ENABLE,
  </code></pre>
  
  <p>How can I create a FK or other constraint that would me to reference
  the union of two tables?</p>