How ad foreign key constraint between to xmltype tables <p>I have two xmltype tables (object-relation storage) in Oracle 10gR2. My steps:</p> <p><strong>#1 register schema</strong></p> <pre><code>begin dbms_xmlschema.registerSchema( 'tab1_schema.xsd', '&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:element name="man"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="man_id" type="xs:int" /&gt; &lt;xs:element name="man_name" type="xs:string" /&gt; &lt;xs:element name="man_date" type="xs:date" /&gt; &lt;xs:element name="cars"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element maxOccurs="unbounded" name="car"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="car_id" type="xs:int" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt;', true, true, false, false); end; / begin dbms_xmlschema.registerSchema( 'tab2_schema.xsd', '&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:element name="car"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="car_id" type="xs:int" /&gt; &lt;xs:element name="car_name" type="xs:string" /&gt; &lt;xs:element name="car_date" type="xs:date" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt;', true, true, false, false); end; / </code></pre> <p><strong>#2 create xmltype tables</strong></p> <pre><code>create table tab1 of xmltype xmlschema "tab1_schema.xsd" element "man"; create table tab2 of xmltype xmlschema "tab2_schema.xsd" element "car"; </code></pre> <p><strong>#3 add primary keys</strong></p> <pre><code>alter table tab1 add constraint tab1_pk primary key (xmldata."man_id"); alter table tab2 add constraint tab2_pk primary key (xmldata."car_id"); </code></pre> <p><strong>#4 QUESTION! How add foreign key for table tab1 (element "/cars/car/car_id") references on table tab2 (element "/car_id")</strong></p> <pre><code>alter table tab1 add constraint tab1_fk foreign key (xmldata."/cars/car/car_id") references tab2(xmldata."car_id"); </code></pre>