title: Constraints interdependent tables
body: <p>I created 2 tables which are dependent on each other like this.</p>
  
  <pre><code>CREATE TABLE A(NO1 NUMBER(2) PRIMARY KEY,NO2 NUMBER(2));
  </code></pre>
  
  <p>Table created.</p>
  
  <pre><code>CREATE TABLE B(NO1 NUMBER(2) PRIMARY KEY,NO2 NUMBER(2));
  </code></pre>
  
  <p>Table created.</p>
  
  <pre><code>ALTER TABLE A ADD CONSTRAINT AA FOREIGN KEY(NO2) REFERENCES B(NO1);
  </code></pre>
  
  <p>Table altered.</p>
  
  <pre><code>ALTER TABLE B ADD CONSTRAINT BB FOREIGN KEY(NO2) REFERENCES B(NO1);
  </code></pre>
  
  <p>Table altered.</p>
  
  <pre><code>INSERT INTO A VALUES(10,20);
  INSERT INTO A VALUES(10,20);
  </code></pre>
  
  <blockquote>
    <p>ERROR at line 1:
    ORA-02291: integrity constraint (SUBK.AA) violated - parent key not found</p>
  </blockquote>
  
  <pre><code>INSERT INTO B VALUES(10,20);
  INSERT INTO B VALUES(10,20);
  </code></pre>
  
  <blockquote>
    <p>ERROR at line 1:
    ORA-02291: integrity constraint (SUBK.BB) violated - parent key not found</p>
  </blockquote>
  
  <p>How to insert data in table <code>a</code> and <code>b</code></p>